我们有一个控制台应用程序,用于调用DbUp(创建数据库,更新,测试数据等)。
我们有一个配置,Stable,配置为不定义DEBUG常量:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Stable|AnyCPU'">
<OutputPath>bin\Stable\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
然而,当它在Octopus上运行时,它总是返回true并保持部署:
#if DEBUG
Console.ReadLine();
#endif
当我在本地(VS)切换到Stable配置时,它会按预期运行并退出。
当我在本地(VS)切换到Debug配置时,它会按预期运行并等待输入。
如果我完全注释掉这些线条,它在八达通上运行正常(退出,八达通上的部署完成)。
这让我质疑我在生活中的所有选择。
知道为什么会这样吗?
EDIT - 用于构建项目的命令(使用TeamCity)
# Database
Invoke-Msbuild "$rootDir\artifacts\output\Database" `
"$rootDir\MyClient.Database\MyClient.Database.csproj" `
-target 'build' `
-toolsVersion 4.0 `
-maxCpuCount 8 `
-VisualStudioVersion 14.0 `
-logPath "$rootDir\artifacts\logs\Database" `
-namespace 'MyClient' `
-customParameters @('/property:RunOctoPack=true', "/property:OctoPackPackageVersion=$version", "/property:OctoPackNuGetProperties=env=$environment")
答案 0 :(得分:1)
构建服务器。八达通部署。
所以我不认为八达通与这个问题有关。 你有像TeamCity这样的构建服务器吗? Perhabs配置有问题吗?
编辑:
你试试这个参数吗?
-MsBuildParameters“/ target:Clean; Build / property:Configuration = Stable; Platform =”“Mixed Platforms”“