VS2010项目依赖

发布于 2024-09-30 23:32:21 字数 667 浏览 0 评论 0原文

我在 VS2010 和 ac# 项目中有一个 C++ 项目,该项目将使用此 C++ 项目输出(它将其用于 p/invoke)。我想我可以通过编辑解决方案中的“项目依赖项...”来确保 c++ 项目在 c# 项目之前构建,但这似乎没有任何效果,我的构建服务器上的构建不尊重此设置(我正在使用 TeamCity 引导构建整个解决方案文件的 MSBuild 文件)

我认为这曾经有效,VS2010 有什么变化吗?或者我应该以另一种方式声明依赖关系?

解决方案:诀窍是在 VS2010 之外手动编辑 csproj 文件并添加如下部分:

<ProjectReference Include="..\CobraLib\CobraLib.vcxproj">
  <Project>{598506DA-91DA-4F25-948D-A14CB16ABEBA}</Project>
  <Name>CobraLib</Name>
  <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>

这使得构建服务器以正确的顺序处理我的项目。唯一需要注意的是 VS2010 在项目引用上显示错误(“不是 .NET 项目”),但除此之外一切都按我的预期运行

I have a c++ project in VS2010 and a c# project that is to consume this c++ project output (it uses it for p/invoke). I was thinking that I could ensure that the c++ project was build before the c# project by editing the "Project dependencies..." in the solution but this does not seem to have any effect, the build on my buildserver does not respect this setting (I'm using TeamCity to bootstrap an MSBuild file that builds the entire solution file)

I think this used to work, has anything changed with VS2010? Or should I declare the dependency in another way?

SOLUTION: The trick was to hand-edit the csproj file outside VS2010 and add a section like this:

<ProjectReference Include="..\CobraLib\CobraLib.vcxproj">
  <Project>{598506DA-91DA-4F25-948D-A14CB16ABEBA}</Project>
  <Name>CobraLib</Name>
  <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>

That made the build server process my projects in the correct order. Only caveat is that VS2010 displays an error on the project reference ("not a .NET project") but otherwise things are working as I intended

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文