如何阻止Visual Studio删除SLN文件中的项目依赖项(或让MSBuild不需要它们) [英] How to stop Visual Studio from removing project dependencies in SLN file (or get MSBuild to not need them)

查看:472
本文介绍了如何阻止Visual Studio删除SLN文件中的项目依赖项(或让MSBuild不需要它们)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的构建服务器上,我们使用MSBuild构建代码。



MSBuild在没有postProject部分的情况下不理解解决方案中项目之间的相互依赖性解决方案文件Visual Studio每次更改解决方案文件时都会删除这些行。



我们可以通过某种方式配置VS以不删除解决方案文件中的这些postProject条目,这样人们就可以添加/删除VS中的项目,而无需为解决方案文件中的每个其他项目删除所需的设置?

On our build server, we build our code using MSBuild.

MSBuild don't understand interdependencies between projects in the solution without having postProject sections in solution file. Visual Studio removes these lines every time it alters solution files.

Is there some way we can configure VS to not remove these postProject entries in solution files, so people can add/remove a project within VS, without having it to remove required settings for every other project in the solution file?



或者,让MSBuild真正理解项目引用,所以我们可以在没有它们的情况下构建。


Or alternatively, get MSBuild to actually understand project references, so we can build without them.

推荐答案

首先,实际上说明你正在使用哪个版本的Visual Studio有用。另外,您使用的是Visual Studio附带的MSBuild,还是使用来自.NET Framework的MSBuild?

First of all, actually stating which version of Visual Studio you are using would be useful. Also, are you using the MSBuild that comes with Visual Studio or are you using MSBuild that comes from the .NET Framework?

其次,VS2017和2019附带的MSBuild完全理解项目引用。所以我建议您使用Visual Studio开发人员命令提示符或Visual Studio构建工具包来构建。

Secondly, MSBuild that comes with VS2017 and 2019 understands project references perfectly fine. So I would suggest you use the Visual Studio developer command prompt, or the Visual Studio build tools package to build.


这篇关于如何阻止Visual Studio删除SLN文件中的项目依赖项(或让MSBuild不需要它们)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆