Visual Studio Solution: How do I build a specific project?

Completed

Is there any way to specify a particular project to build with the Visual Studio or MSBuild runners?  The use case would be something similar to calling devenv like this:

devenv MySolution.sln  /build Release /project AParticularProject

That has the effect of building a project and its dependencies, similar to how you would in a make system.  What I cannot find is a way to accomplish the same thing from either the Visual Studio or MSBuild runners without creating an additional MSBuild script file to create a specific target for each (configuration, project) pair.

0
2 comments
Avatar
Permanently deleted user

I think that I was a little fuzzy on the exact syntax that msbuild requires for specifying a target.

You can do this with the Visual Studio Runner (and probably also the MSBuild runner as well):

  1. Create a Visual Studio Runner build step
  2. Set your solution file
  3. Set the Target to the project name together with the build type (Build/Rebuild/Publish/etc).  e.g. "AParticularProject:Build".  If you are getting "target not found" errors, note:  It's also important to specify the 'virtual path' to your project in this case.  For instance, if you have a filter hierarchy in your solution, you need to specify the filter path to the project (this was the part that through me off).
  4. Set the appropriate Configuration (Release/Debug/etc)

 

1
Avatar
Permanently deleted user

In case anyone else is trying this - there are a few things to keep in mind.

Expanding on point # 3 from Matthew: when he refers to "virtual path" that means a Solution virtual directory (this is where you right-click the Solution directly and create a directory, which isn't a real filesystem directory). If a project is moved into one of these virtual directories, "AParticularProject:Build" turns into "VirtualSlnDir\AParticularProject:Build"

If your project name contains a period: replace periods with underscores. Yes, "AParticular.Project" name turns into "AParticular_Project:Build".

Reference: https://stackoverflow.com/a/19534376/238722

Below is what ended up being my actual step configuration:

1

Please sign in to leave a comment.