如何构建 VS2010 C++构建服务器上的项目
我有一个 .NET 解决方案,其中包含使用 VS2010 创建的针对 .NET 3.5 的托管 C++ 组件。命令:
%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MyProject.sln
在我的开发机器上编译解决方案。
在我的 BuildServer 上,我收到此错误:
构建失败。
“F:\CruiseControl.NET\Projects\MyProject\MyProject.sln” (默认目标) (1) -> “F:\CruiseControl.NET\Projects\MyProject\MyProject\MyProject.csproj” (默认目标) (2) -> “F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj” (默认目标)(3) ->
F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj(23,3): 错误 MSB4019:导入的项目 “C:\程序 文件\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props” 没有找到。确认路径 在声明中是 正确,并且该文件存在于 磁盘。
0 警告 1 个错误
在我的开发机器上声明的文件
“C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props”
存在。在我的构建服务器上没有。
当我尝试复制此文件(以及同一目录中的所有其他文件)时,发生了其他错误。所以这是错误的方法。
编辑:其他错误意味着:当我在构建服务器上复制文件“Microsoft.Cpp.Default.props”时,MSBuild 正在声明其他文件。这告诉我,仅仅复制丢失的文件并不是构建环境所期望的。我正在寻找一个 MSI/任何可以安装在我的构建服务器上的包,并且任何 C++ 项目都将构建。安装 SDK 并没有解决问题。或者是我在安装SDK的时候做错了什么。或者仅使用 SDK 无法编译托管 C++ VS2010 解决方案。
我相信“其他错误”与我的问题无关。我的问题是:“如何正确设置我的构建环境”。 /编辑
到目前为止我所做的:
- 我已经安装了最新的Win7 SDK(链接)
- 我的目标是 .net 3.5
- 我尝试使用 Platform Toolset Property - 但它只是在玩
- 在我的解决方案中有一个托管 C++ 程序集(我的问题)
- 我正在使用 MSBuild 4.0 因为新的 VS2010 项目文件不能使用 MSBuild 3.5 进行编译
- 我正在使用 CC.NET。 CC.NET 和命令行上的编译失败。所以应该不是CC.NET的问题。
是否有任何提示和技巧如何正确配置我的项目,以便在我的开发机器上使用 VS2010 和 在我的构建服务器上进行编译?还需要安装什么吗(VS2010除外)?
谢谢,亚瑟
I've a .NET Solution with a managed C++ assemlby Targeting .NET 3.5 created with VS2010. The command:
%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MyProject.sln
compiles the solution on my dev machine.
On my BuildServer I get this error:
Build FAILED.
"F:\CruiseControl.NET\Projects\MyProject\MyProject.sln"
(default target) (1) ->
"F:\CruiseControl.NET\Projects\MyProject\MyProject\MyProject.csproj"
(default target) (2) ->
"F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj"
(default target) (3) ->
F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj(23,3):
error MSB4019: The imported project
"C:\Program
Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"
was not found. Confirm that the path
in the<Import>
declaration is
correct, and that the file exists on
disk.0 Warning(s) 1 Error(s)
On my dev machine the claimed file
"C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"
exists. On my build server not.
When I try to copy this files (and all others in the same directory) other errors occurred. So this is the wrong way.
EDIT: other errors means: When I copy the file "Microsoft.Cpp.Default.props" on the build server, MSBuild is claiming other files. That shows me, that just doing a copy of missing files is not what the build environment is expecting. I am looking for an MSI/whatever package that I could install on my build server and any C++ Project will build. Installing the SDK did not the trick. Or I did something wrong during SDK installation. Or it is not possible to compile Managed C++ VS2010 Solutions just with the SDK.
I believe that "other errors" has nothing to do with my problem. My Problem is: "How do I setup my build environment correctly". /EDIT
What I've done till now:
- I have installed the latest Win7 SDK (Link)
- I am targeting .net 3.5
- I've tried playing with the Platform Toolset Property - but it was just playing
- In my solution there is a managed C++ Assembly (my Problem)
- I am using MSBuild 4.0 because the new VS2010 project files cannot be compiled with MSBuild 3.5
- I am using CC.NET. compilation fails in CC.NET and on the command line. So it should not be a CC.NET issue.
Are there any tips and tricks how to configure my project properly to compile on my dev machine with VS2010 and on my build server? Is there anything more to install (except VS2010)?
Thanks, Arthur
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
目前,安装 VS 2010 是您唯一安全的选择。 Windows SDK 将进行更新以支持您的方案,但我没有具体的发布日期。在此之前,您需要使用 C++ 工具安装 VS 2010,以便使用 C++ 项目构建 2010 解决方案。确保通过 团队博客和/或MSDN 论坛。
即使安装了 VS 2010 后,您也可能需要调用相应的 vcvars*.bat 文件来正确设置环境变量。
For now, installing VS 2010 is your only safe option. The Windows SDK will be updated to enable your scenario, but I don't have a specific release date. Until then, you'll need to install VS 2010 with the C++ tools in order to build your 2010 solution with C++ projects. Make sure you let the C++ team know about how dissatisfaction with this situation via their team blog and/or MSDN Forum.
Even after installing VS 2010, you may need to invoke the appropriate vcvars*.bat file to setup your environment variables correctly.
为什么不想在构建服务器上安装 VS2010?如果是许可,则它是按开发人员头而不是按安装进行许可的,因此我有理由确定您可以在不购买其他副本的情况下获得许可 - 或者,最坏的情况是,您可以安装 Express 版本,该版本至少应该安装您所需要的配置位缺少,因此您可以使用平台 SDK 编译器。
如果您在使用 msbuild 时仍然遇到问题,则可以使用 devenv.com /build 来精确复制 VS 构建环境。
Why don't you want to install VS2010 on your build server? If it's licencing, it's licenced per developer head not per install so I'm reasonably sure you are allowed to without buying another copy - or, at worst, you can install the express version which ought to at least install the config bits you're missing so you can use the platform SDK compiler.
If you're still having problems with msbuild you can then use
devenv.com /build
which exactly replicate the VS build env.您可以尝试这些链接:
http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/9055ca52-586b-459f-9dd1-a9d052d076b9/
或
http://msdn.microsoft.com/en-us/library/ee662426.aspx
You may try those links:
http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/9055ca52-586b-459f-9dd1-a9d052d076b9/
or
http://msdn.microsoft.com/en-us/library/ee662426.aspx