如何使用VS2010中的MSBuild在解决方案中定位特定的.NET项目? [英] How do I target a specific .NET project within a Solution using MSBuild from VS2010?

查看:112
本文介绍了如何使用VS2010中的MSBuild在解决方案中定位特定的.NET项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MSBuild命令行,可以构建一个完整的解决方案.看起来像这样:

I have an MSBuild command line that can build an entire solution. It looks something like this:

msbuild SomeSolution.sln/p:Configuration:CustomDebug; Platform = OurPlatform/nodeReuse:false/maxcpucount:4/t:Build

我知道对于C ++解决方案,可以使用以下语法来定位特定项目:

I know that for C++ Solutions, specific projects can be targeted using the following syntax:

msbuild SomeSolution.sln/p:Configuration:CustomDebug; Platform = OurPlatform/nodeReuse:false/maxcpucount:4 /t:Folder \ SomeCppProject; Build

我正在尝试在解决方案中为.NET项目实现相同的目的.这不起作用:

I'm trying to achieve the same thing for .NET projects within a solution. This does NOT work:

msbuild SomeSolution.sln/p:Configuration:CustomDebug; Platform = OurPlatform/nodeReuse:false/maxcpucount:4 /t:SomeDotNetProject; Build

有人知道如何在.NET项目的命令行上使用MSBuild将解决方案内的特定项目作为目标吗?我知道我可以创建一个自定义MSBuild项目来实现我的目标,但是我需要与Visual Studio共享解决方案和项目.

Does anyone know how to target a specific project within a solution using MSBuild on the command line for .NET projects? I know I can create a custom MSBuild project to achieve what I'm after, but I need to share the solution and projects with Visual Studio.

谢谢!
-西恩(Sean)

Thanks!
-Sean

推荐答案

您需要在Visual Studio解决方案文件中指定任何解决方案文件夹,并替换任何".在项目名称中使用"_":

You'll need to specify any solution folders in the Visual Studio solution file, and replace any "." in the project name with "_":

msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /t:Folder\Project_Name

例如,如果解决方案文件夹"Deploy"中有一个名为"MyApplication.Deployment.csproj"的项目,则需要

For example, if you have a project in the solution folder "Deploy" named "MyApplication.Deployment.csproj", you'll need

msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /t:Deploy\MyApplication_Deployment

通常是Visual Studio中显示的解决方案文件夹不是文件系统文件夹:将被忽略.

Incidentially this is a solution folder, as displayed in Visual Studio, not a file system folder: those are ignored.

这篇关于如何使用VS2010中的MSBuild在解决方案中定位特定的.NET项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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