我有以下MSBuild脚本:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Main" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<build_configurations>test1;test2;test3</build_configurations>
</PropertyGroup>
<ItemGroup>
<BuildConfigurations Include="$(build_configurations)" />
</ItemGroup>
<Target Name="Main">
<Message Text="Running with args: %(BuildConfigurations.Identity)" />
</Target>
</Project>
Run Code Online (Sandbox Code Playgroud)
如果我在没有任何参数的情况下调用脚本,我会得到预期的响应:
Running with args: test1
Running with args: test2
Running with args: test3
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试通过命令行设置属性时,如下所示:
msbuild [myscript] /p:build_configurations=test5%3btest6%3btest7
Run Code Online (Sandbox Code Playgroud)
我得到以下内容:
Running with args: test5;test6;test7
Run Code Online (Sandbox Code Playgroud)
所以,它没有按预期进行批处理.我需要让MSBuild创建具有三个项目而不是一个项目的项目组.我该怎么办?谢谢.
PS以下文章基本上解决了我的问题,除了我想传递以分号分隔的值的情况:http://sedodream.com/CommentView,guid,096a2e3f-fcff-4715-8d00-73d8f2491a13.aspx
使用Powershell和Psake为可视化工作室解决方案创建包和部署.尝试使用msbuild部署数据库项目 - 使用msdos visual studio命令行正常工作
msbuild /target:Deploy /p:UseSandboxSettings=false /p:TargetConnectionString="aConnectionWithSpacesAndSemiColons" "aDatabaseProjectPathWithSpaces"
Run Code Online (Sandbox Code Playgroud)
从powershell调用时,相同的方法调用会导致错误
& msbuild /target:Deploy /p:UseSandboxSettings=false /p:TargetConnectionString="aConnectionWithSpacesAndSemiColons" "aDatabaseProjectPathWithSpaces"
Run Code Online (Sandbox Code Playgroud)
与空间有关 - 无法弄清楚如何在powershell中复制此调用 - 示例数据库连接字符串数据源=.\ SQL2008;初始目录= DocumentExecution; Integrated Security = True;