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

查看:16
本文介绍了如何使用 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:FolderSomeCppProject;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.

谢谢!
-肖恩

推荐答案

您需要在 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:FolderProject_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:DeployMyApplication_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天全站免登陆