从Visual Studio解决方案文件和项目文件生成MSBUILD项目文件 [英] Generating an MSBUILD project file from a visual studio solution file and project files

查看:69
本文介绍了从Visual Studio解决方案文件和项目文件生成MSBUILD项目文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以传递MSBuild VS解决方案文件(.sln),它将建立解决方案,但是在我脑海中的某个地方,我记得使用了一个MSBuild命令行开关来接收解决方案文件(引用的项目文件),并从中生成一个MSBuild项目文件.但是,我现在找不到此开关! 这都是梦吗?

I know that I can pass MSBuild a VS solution file (.sln) and it will build the solution but somewhere in the back of my mind, I remember using a MSBuild command line switch that would take a solution file (and it's referenced project files) and generate a single MSBuild project file from them. However, I now can't find this switch! Was this all a dream?

我看到了/preprocess开关(缩写为/pp),但我不认为是这样,因为它将包括所有导入的文件(包括Microsoft.*.targets),除此之外我无法似乎可以使此开关正常工作.我在尝试以下命令行时,MSbuild生成了*.out文件,但它为空!

I see the /preprocess switch (short form /pp) but I don't think that this was it as this will include all of the imported files (including Microsoft.*.targets) and besides I can't seem to get this switch to work. I when I try the following command line, MSbuild generates the *.out file but its empty!

msbuild /target:rebuild /generate MSBuildCopyTargets.sln

推荐答案

最简单的方法是从命令行运行MSBuild,并设置环境变量:

The easiest way to do this is to run MSBuild from the command line, with an environment variable set:

  Set MSBuildEmitSolution=1

输出将采用格式SolutionName.metaproj

The output will be in the format SolutionName.metaproj

这篇关于从Visual Studio解决方案文件和项目文件生成MSBUILD项目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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