mageos
mageos

Reputation: 1291

How do I add a custom msbuild project to visual studio

I want to add a custom MSBuild project file to my solution. I have looked and there is the ability to add a .msbuildproj to the solution, but everytime I try to do it, it hangs Visual Studio.

What I am trying to do is add a project file that I can run MSBuild tasks as part of the overall solution build process.

EDIT

I am not looking to extend the existing build process. I want to add a new project to solution that is not a csharp or cpp project.

Upvotes: 4

Views: 1262

Answers (1)

d3r3kk
d3r3kk

Reputation: 4065

Create a .targets file called the same thing as your solution. Add your custom task(s) to run during a build into that new .targets file, and then insert something like this into each .*proj file included in your solution:

<Import Project="$(SolutionDir)$(SolutionName).targets" Condition="Exists('$(SolutionDir)$(SolutionName).targets')" />

Be sure to inject this line just above the line in the file (near the end of the file) that reads:

</Project>

Upvotes: 1

Related Questions