如何在 MSBuild 中添加自定义属性作为 PropertyGroup 的子项?
我有以下构建脚本,我使用 MSBuild 运行该脚本:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion ="3.5">
<PropertyGroup>
<BuildDir Condition=" '$(BuildDir)'==' ' ">$(BaseDir)/build</BuildDir>
<ProdDir >$(BuildDir)/prod</ProdDir>
<TestDir>$(BuildDir)/test</TestDir>
<MMC2SourceDir>SteuerungsZugriffTest/mmc2</MMC2SourceDir>
<UserSourceDir>SteuerungsZugriffTest/user</UserSourceDir>
<TestXMLDir>$(BuildDir)/test-results</TestXMLDir>
<SolutionFile Condition=" '$(SolutionFile)'==' ' ">HMI2.0.sln</SolutionFile>"
<NUnitTest>nunit-console.exe</NUnitTest>
</PropertyGroup>
<Target Name="Prepare">
<Message Text="Prepare everything" />
<MakeDir Directories="$(BuildDir)" />
<MakeDir Directories="$(ProdDir)" />
</Target>
...
当我现在在命令行上启动脚本时:
D:\MyDir>msbuild /property:BaseDir=D:\MyDir MyScript.build
我在命令行输出上收到以下错误:
D:\MyDir>MyScript.build(11,78): error MSB4067: Das <#text>-Element unterhalb des <PropertyGroup>-Elements ist unbekannt.
这基本上意味着: 元素<#text>是一个未知的孩子。
有人有想法吗?
编辑:抱歉,我现在完成了脚本
I have the following build script, which I run with MSBuild:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion ="3.5">
<PropertyGroup>
<BuildDir Condition=" '$(BuildDir)'==' ' ">$(BaseDir)/build</BuildDir>
<ProdDir >$(BuildDir)/prod</ProdDir>
<TestDir>$(BuildDir)/test</TestDir>
<MMC2SourceDir>SteuerungsZugriffTest/mmc2</MMC2SourceDir>
<UserSourceDir>SteuerungsZugriffTest/user</UserSourceDir>
<TestXMLDir>$(BuildDir)/test-results</TestXMLDir>
<SolutionFile Condition=" '$(SolutionFile)'==' ' ">HMI2.0.sln</SolutionFile>"
<NUnitTest>nunit-console.exe</NUnitTest>
</PropertyGroup>
<Target Name="Prepare">
<Message Text="Prepare everything" />
<MakeDir Directories="$(BuildDir)" />
<MakeDir Directories="$(ProdDir)" />
</Target>
...
When I now start script on the command line:
D:\MyDir>msbuild /property:BaseDir=D:\MyDir MyScript.build
I got the following error on the commandline output:
D:\MyDir>MyScript.build(11,78): error MSB4067: Das <#text>-Element unterhalb des <PropertyGroup>-Elements ist unbekannt.
Which basically means: The element<#text> is an unknown child.
Does anybody have an idea?
Edit: Sorry, I completed now the script
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在该行的末尾有一个额外的“
它位于标签之外,因此它被视为文本元素......
You have an extra " at the end of this line
It is outside a tag, so it is considered as a text element...