如何使用 TFS Build 构建 VS2010 MakeFile 项目 (vcxproj

时间:2023-03-30
本文介绍了如何使用 TFS Build 构建 VS2010 MakeFile 项目 (vcxproj)(无 VS 2010)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 VS 2008 中构建良好的项目,然后我们安装并开始使用 TFS Build,然后我们升级到 TFS 2010.一切都很好并且构建正确(在我实施了新的构建过程之后从任何远程 Visual Studio 2010 客户端单击构建启动,一切都非常好).Visual Studio 不需要安装在 Build Agent 上.我正在非常努力(非常很难)不在 Build Agent 上安装 Visual Studio,因为我的理解是没有必要,而且我们没有获得在非开发机器上安装它的许可.

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). Visual Studio did not need to be installed on the 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.

现在我尝试将解决方案升级到 VS 2010,仍然针对 .NET 3.5,因为它是针对 SQL Server CLR 过程的程序集,而 SQL Server 还不支持 .NET 4.0.但我根本无法在 TFS Build 下再构建它.我似乎无法从 TFS Build 和 MS Build 命令行获得一致的错误消息,但我认为这与 Microsoft.Cpp.Targets 不在 C:Program FilesMSBuild 中有关,因为我没有'未安装 Visual Studio.我确实安装了 Microsoft Windows SDK 7.1,以便可以为其他一些 .NET 4.0 项目运行 .NET 4.0 SDK 工具(如 svcutil),但似乎没有安装此构建所需的东西.TFS 构建给我的错误是:

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. But I simply cannot make it build any more under 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 FilesMSBuild because I haven't installed 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. The error TFS build gives me is:

C:TFSBld[...]GenerateLanguageGenerateLanguage.vcxproj(46,3):错误 MSB4019:导入的项目C:Microsoft.Cpp.Default.props"原为未找到.确认路径在声明正确,并且该文件存在于磁盘上.

C:TFSBld[...]GenerateLanguageGenerateLanguage.vcxproj(46,3): error MSB4019: The imported project "C:Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

当我点击该错误时,它会将我带到 vcxproj 文件中的这一行:

And when I click on that error it takes me to this line in the vcxproj file:

  <Import Project="$(VCTargetsPath)Microsoft.Cpp.Default.props" />

在这个项目中我真正需要做的就是运行 resgen 以从 resx 文件生成资源文件,并将它们编译成卫星程序集.我正在使用 makefile 构建来执行此操作,手动运行 resgen(我认为这是因为我找不到任何其他方式将卫星程序集编译为独立解决方案的方法),然后将它们编译成 DLL(我现在不记得它是如何工作的,但我认为它是手动运行 AL.exe 来从资源文件编译 DLL 文件).所以基本上我只需要运行命令行来构建这个项目,而我似乎找不到合理的方法来完成它而不扔掉整个项目并编辑TFS构建脚本来运行一堆硬编码的命令行反而.一定有更好的方法.

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. 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). 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. There's got to be a better way.

我整天都在做这件事,并尝试编写我自己的 .targets 文件和 .xml 属性表来代替标准文件,但我想不通.我尝试简单地删除这些行,但随后 MSBuild 抱怨没有构建"目标.我尝试向 vcxproj 文件添加一个虚拟对象,但它似乎没有运行所有工作都已完成的构建前和构建后步骤.

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. I tried simply deleting the lines, but then MSBuild complains that there's no "Build" target. 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.

推荐答案

Microsoft Windows SDK 7.1 有几个安装选项.仅检查.NET 开发"子工具"显然不足以构建 vcxproj 项目,即使它们不包含任何 C++ 代码(仅构建前和构建后步骤).添加Visual C++ 编译器"选项并完全选中智能感知和参考程序集"复选框会安装必要的文件和设置.我不确定两者是否都是必要的,但这种组合确实对我有用.

The Microsoft Windows SDK 7.1 has several installation options. 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). Adding the "Visual C++ compilers" option and fully selecting the "Intellisense and Reference Assemblies" checkbox installs the necessary files and settings. I'm not sure if both are necessary, but that combination did work for me.

这篇关于如何使用 TFS Build 构建 VS2010 MakeFile 项目 (vcxproj)(无 VS 2010)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:新的 .csproj 格式 - 如何将整个目录指定为“链接 下一篇:ASP.NET Core Application (.NET Framework) for Windows x64 onl

相关文章

最新文章