[英]How to build a VS2010 MakeFile project (vcxproj) with TFS Build (No VS 2010)
I have a project that was building fine in VS 2008, and then we installed and started using TFS Build, and then we upgraded to TFS 2010. Everything was still fine and building correctly (after I implemented our new build process that made everything very nice with a single-click build initiation from any remote Visual Studio 2010 client). 我有一个在VS 2008中正常构建的项目,然后我们安装并开始使用TFS Build,然后我们升级到TFS 2010.一切都很好并且构建正确(在我实现新的构建过程之后,使一切都非常好从任何远程Visual Studio 2010客户端单击构建启动)。 Visual Studio did not need to be installed on the Build Agent.
Visual Studio不需要安装在Build Agent上。 I'm trying very hard ( very hard) not to install Visual Studio on the Build Agent because my understanding is that it's not necessary, and we're not licensed to install it on a non-development machine.
我非常努力( 非常努力)不在构建代理上安装Visual Studio,因为我的理解是没有必要,并且我们没有许可将它安装在非开发机器上。
Now I tried upgrading the solution to VS 2010, still targeting .NET 3.5 because it's an assembly targeted for SQL Server CLR procedures, and SQL Server doesn't support .NET 4.0 yet. 现在我尝试将解决方案升级到VS 2010,仍然针对.NET 3.5,因为它是针对SQL Server CLR过程的程序集,而SQL Server还不支持.NET 4.0。 But I simply cannot make it build any more under TFS Build.
但我根本无法在TFS Build下进行构建。 I can't seem to get a consistent error message from TFS Build and from an MS Build command line, but I think it has something to do with Microsoft.Cpp.Targets not being in C:\\Program Files\\MSBuild\\ because I haven't installed Visual Studio.
我似乎无法从TFS Build和MS Build命令行获得一致的错误消息,但我认为它与Microsoft.Cpp.Targets不在C:\\ Program Files \\ MSBuild \\中有关,因为我没有没有安装Visual Studio。 I did install the Microsoft Windows SDK 7.1 so that I could run the .NET 4.0 SDK tools like svcutil for some other .NET 4.0 projects, but nothing seems to install what this build wants.
我确实安装了Microsoft Windows SDK 7.1,这样我就可以为其他一些.NET 4.0项目运行像svcutil这样的.NET 4.0 SDK工具,但似乎没有安装这个构建所需的东西。 The error TFS build gives me is:
TFS构建错误给我的是:
C:\\TFSBld[...]\\GenerateLanguage\\GenerateLanguage.vcxproj(46,3): error MSB4019: The imported project "C:\\Microsoft.Cpp.Default.props" was not found.
C:\\ TFSBld [...] \\ GenerateLanguage \\ GenerateLanguage.vcxproj(46,3):错误MSB4019:找不到导入的项目“C:\\ Microsoft.Cpp.Default.props”。 Confirm that the path in the declaration is correct, and that the file exists on disk.
确认声明中的路径是否正确,以及该文件是否存在于磁盘上。
And when I click on that error it takes me to this line in the vcxproj file: 当我点击该错误时,它会将我带到vcxproj文件中的这一行:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
All I really need to do in this project is run resgen to generate resources files from resx files, and compile them into sattelite assemblies. 我真正需要在这个项目中做的就是运行resgen来从resx文件生成资源文件,并将它们编译成sattelite程序集。 I was using a makefile build to do this, manually running resgen (I think it was because I can't find a way to compile sattelite assemblies as a stand-alone solution any other way), and then compile those into a DLL (I can't remember how that worked now, but I think it was manually running AL.exe to compile DLL files from resources files).
我正在使用makefile构建来执行此操作,手动运行resgen(我认为这是因为我无法找到将sattelite程序集编译为独立解决方案的方法),然后将它们编译成DLL(I不记得现在怎么工作,但我认为是手动运行AL.exe从资源文件编译DLL文件)。 So basically I just need to run command lines to build this project, and I can't seem to find a reasonable way to do it without throwing out the entire project and editing the TFS build script to run a bunch of hard-coded command lines instead.
所以基本上我只需要运行命令行来构建这个项目,我似乎找不到合理的方法来做到这一点而不抛弃整个项目并编辑TFS构建脚本来运行一堆硬编码的命令行代替。 There's got to be a better way.
必须有一个更好的方法。
I've been at this all day, and tried writing my own .targets file and .xml property sheets to take the place of the standard file, but it's way over my head. 我整天都在这里,并尝试编写自己的.targets文件和.xml属性表来代替标准文件,但它已经超出了我的想象。 I tried simply deleting the lines, but then MSBuild complains that there's no "Build" target.
我试过简单地删除这些行,但是然后MSBuild抱怨没有“Build”目标。 I tried adding a dummy to the vcxproj file, but then it didn't seem to run the pre- and post-build steps where all the work is done.
我尝试在vcxproj文件中添加一个虚拟对象,但是它似乎没有运行完成所有工作的构建前和构建后步骤。
The Microsoft Windows SDK 7.1 has several installation options. Microsoft Windows SDK 7.1有几个安装选项。 Having only the ".NET Development" child "Tools" checked is apparently not enough to build vcxproj projects, even if they don't include any C++ code (only pre- and post-build steps).
仅检查“.NET开发”子项“工具”显然不足以构建vcxproj项目,即使它们不包含任何C ++代码(仅在构建前和构建后步骤)。 Adding the "Visual C++ compilers" option and fully selecting the "Intellisense and Reference Assemblies" checkbox installs the necessary files and settings.
添加“Visual C ++编译器”选项并完全选择“智能感知和参考组件”复选框将安装必要的文件和设置。 I'm not sure if both are necessary, but that combination did work for me.
我不确定两者是否都是必要的,但这种组合对我有用。
I have devised a somewhat complex, but functional work around involving the following steps. 我已经设计了一个涉及以下步骤的有点复杂但功能性的工作。
An improved alternative to BlueMonkMN is to add BlueMonkMN的改进替代方案是添加
<PropertyGroup>
<VCTargetsPath Condition="'$(VCTargetsPath)' == ''">[path_to_the_fileset_listed]</VCTargetsPath>
</PropertyGroup>
as a level 1 child near the top of the vcxproj. 作为vcxproj顶部附近的1级孩子。
The path could include an environment variable or some other well-known path containing variable. 该路径可以包括环境变量或包含变量的一些其他众所周知的路径。
This makes less of an an intrusion and is easier to revert than changing lots of lines. 这样可以减少入侵,并且比更改大量行更容易还原。
An even more simple approach with adding an environment variable for VCTargetsPath
: 为
VCTargetsPath
添加环境变量的更简单方法:
C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\V120
C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\V120
Control Panel > System > Advanced Settings > Advanced > Environment Variables
VCTargetsPath
VCTargetsPath
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.