TeamCity 表示要使用“构建参数”而不是“/属性:”在 MSBuild 步骤中。这意味着什么?
我有一个 TeamCity 服务器设置来进行 CI 构建。我正在构建和测试 C# 解决方案并运行一些自定义 MSBuild 任务。其中一项任务是在我的构建输出中打印警告......
MSBuild 命令行参数包含“/property:”或“/p:”参数。请改用构建参数。
我不明白这意味着什么或如何删除它。它不能很好地谷歌(有或没有打字错误)。我从命令行(使用 /verbosity:diagnostic
)运行该任务,但它没有出现,所以我相信这是一条 TeamCity 消息。
MSBuild 任务是
<Target Name="InstallDb">
<MakeDir Directories="$(DbPath)" />
<Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseDrop.sql" />
<Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseCreate.sql -v DbPath="$(DbPath)"" />
<Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseProgrammability.sql" />
</Target>
相关的 TeamCity 步骤信息是
MSBuild 版本:4.0
MSBuild 工具版本:4.0
运行平台:x64
目标:InstallDb
命令行参数:/property:DbPath=%env.DB_PATH%
I have a TeamCity server setup to do my CI builds. I'm building and testing a C# solution and running some custom MSBuild tasks. One of these tasks is printing a warning in my build output...
MSBuild command line parameters contains "/property:" or "/p:" parameters. Please use Build Parameteres instead.
I don't understand what this means or how to remove it. It doesn't Google well (with or without the typo). I ran the task from the command line (with /verbosity:diagnostic
) and it doesn't appear, so I believe it's a TeamCity message.
The MSBuild task is
<Target Name="InstallDb">
<MakeDir Directories="$(DbPath)" />
<Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseDrop.sql" />
<Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseCreate.sql -v DbPath="$(DbPath)"" />
<Exec Command="sqlcmd -S .\sqlexpress -i db\OmnyxDatabaseProgrammability.sql" />
</Target>
And the relevant TeamCity step information is
MSBuild version: 4.0
MSBuild ToolsVersion: 4.0
Run platform: x64
Targets: InstallDb
Command line parameters: /property:DbPath=%env.DB_PATH%
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须添加
构建参数
在配置中的属性和环境
变量下`
因此,在 MSBUild 的
Build Step
的命令行参数中,删除指定为/p:
的所有属性,并将每个属性添加到Build参数
(上面的屏幕截图)并给出值You have to add
Build Parameters
underProperties and environment
variables in the configuration`
So in the command line parameters in the
Build Step
for MSBUild, remove any property that is specified as/p:
and add each of those to theBuild Parameters
( screenshot above) and give the values这一切都发生在幕后!您只需遵循正确的约定即可。在您的 MSBuild 脚本中,您使用常规变量表示法
。在 TeamCity 中,您定义一个系统或环境变量。TeamCity
会自动将其所有系统/环境变量发送到您的 MSBuild 任务,删除“system”或“env”部分。而且您不必在 TeamCity 任务中编写
/property:DbPath=system.DbPath
。It all happens behind the scenes! You just have to follow the right conventions. In your MSBuild script, you use the regular variable notation
And in TeamCity, you define a system or env variable
TeamCity will automagically send all of its system/env variables to your MSBuild task, removing the 'system' or 'env' part. And you don't have to write
/property:DbPath=system.DbPath
in your TeamCity task.