MSBuild:指定用于子版本的平台时出现问题 [英] MSBuild: Problems specifying platform for child builds
问题描述
在构建项目时是否可以指定目标平台(x64,x86)?
我有一个构建任务,如下所示:
<MSBuild Projects="%(AgentProjectFiles.FullPath)" Properties="Architecture=x86;Configuration=$(Configuration);Optimize=$(Optimize);Platform=$(Platform);OutputPath=$(OutputDirectory)\Agent\;ReferencePath=$(ReferencePath);DebugSymbols=$(DebugSymbols);DebugType=none;" />
您可能会说,我将网上看到的所有内容都扔到了Properties属性中,希望它能正常工作.您会注意到,对于Architecture属性,我将其显式设置为x86. $(Platform)也设置为x86.我尝试了许多排列,但没有成功.
不幸的是,似乎无论将什么放入这些属性中,我的类库都是x86,但是我的可执行文件是x64.
我认为问题可能出在项目文件本身中指定的构建属性导致MSBuild忽略了我从MSBuild传递过来的那些属性,但是将其更改为x86后,我仍然遇到相同的问题.
有什么想法吗?
在 AgentProjectFiles 项的声明中,您定义 Properties 元数据.看起来是这样的吗?
<ItemGroup>
<AgentProjectFiles Include="something.proj">
<Properties>SOME VALUES HERE</Properties>
</AgentProjectFiles>
</ItemGroup>
如果已定义该属性,则将属性传递到 MSBuild任务将被忽略.我已经通过博客发布了有关 MSBuild:已知的元数据和属性.. >
易卜拉欣·哈希米说
我的书:在Microsoft Build Engine内部:使用MSBuild和团队基础建设
Is it possible to specify the target platform (x64, x86) when building a project?
I have a build task that looks as follows:
<MSBuild Projects="%(AgentProjectFiles.FullPath)" Properties="Architecture=x86;Configuration=$(Configuration);Optimize=$(Optimize);Platform=$(Platform);OutputPath=$(OutputDirectory)\Agent\;ReferencePath=$(ReferencePath);DebugSymbols=$(DebugSymbols);DebugType=none;" />
As you can probably tell, I've thrown everything possible I have seen online into the Properties attribute in the hope that it will work. You will notice that for the Architecture property I've set it to be x86 explicitly. the $(Platform) is also set to x86. I've tried a number of permutations, without success.
Unfortunately, it seems that no matter what gets put into these properties, my class libraries are x86, but my executables are x64.
I thought perhaps the problem could be that the build properties specified in the project file itself were causing MSBuild to ignore the ones I pass through from MSBuild, but after changing these to x86, I still have the same problem.
Any ideas?
In the declaration of the AgentProjectFiles item are you defining the Properties metadata. So does it look like:
<ItemGroup>
<AgentProjectFiles Include="something.proj">
<Properties>SOME VALUES HERE</Properties>
</AgentProjectFiles>
</ItemGroup>
If you have defined that then the properties passed into the Properties attribute of the MSBuild task are ignored. I've bloged about this MSBuild: Properties and AdditionalProperties Known Metadata.
Sayed Ibrahim Hashimi
My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build
这篇关于MSBuild:指定用于子版本的平台时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!