Click here to Skip to main content
14,176,439 members
Click here to Skip to main content
Add your own
alternative version


25 bookmarked
Posted 6 Apr 2011
Licenced CPOL

Creating MSBuild projects from .sln files.

, 6 Apr 2011
Rate this:
Please Sign up or sign in to vote.
If you want to create MSBuild files, and only have Visual Studio solutions, take heart - there is a trick that will help you out.
I recently had a need to create an MSBuild file for a complex (multi-project) solution in VS2010. By default .sln files are not in msbuild format, but they can be called from MSBuild - while I could have done this, I didn't want to - I wanted a proper MSBuild solution. Fortunately, there is a way to convert the .sln file into an MSBuild .proj file. Open up a Visual Studio command prompt and type in the following:
set MSBuildEmitSolution=1
msbuild <<your project>>.sln 
That's it. If your solution builds successfully, an addition MSBuild .proj file is created (this is the file that MSBuild creates internally to process .sln files). It's that simple.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Pete O'Hanlon
United Kingdom United Kingdom
A developer for over 30 years, I've been lucky enough to write articles and applications for Code Project as well as the Intel Ultimate Coder - Going Perceptual challenge. I live in the North East of England with 2 wonderful daughters and a wonderful wife.

I am not the Stig, but I do wish I had Lotus Tuned Suspension.

You may also be interested in...


Comments and Discussions

QuestionWhat makes an msbuild.proj file more proper than the solution file? Pin
Roel Schreurs23-Jun-16 1:13
memberRoel Schreurs23-Jun-16 1:13 
AnswerRe: What makes an msbuild.proj file more proper than the solution file? Pin
Pete O'Hanlon23-Jun-16 2:12
protectorPete O'Hanlon23-Jun-16 2:12 
QuestionWorkaround/Update for VS 2013 Pin
mrchief_200010-Dec-14 9:56
membermrchief_200010-Dec-14 9:56 
QuestionNice! Pin
drhender18-Nov-13 6:40
memberdrhender18-Nov-13 6:40 
QuestionIn Application Pin
Éverton França18-Jul-13 9:15
memberÉverton França18-Jul-13 9:15 
AnswerRe: In Application Pin
Pete O'Hanlon18-Jul-13 9:23
protectorPete O'Hanlon18-Jul-13 9:23 
GeneralUseful! Pin
Brisingr Aerowing29-Mar-13 14:18
professionalBrisingr Aerowing29-Mar-13 14:18 
QuestionNice one! Pin
Xandip27-Sep-12 21:46
memberXandip27-Sep-12 21:46 
AnswerRe: Nice one! Pin
Member 947095929-Sep-12 9:39
memberMember 947095929-Sep-12 9:39 
GeneralClean and Simple Pin
MackZero29-Aug-12 10:36
memberMackZero29-Aug-12 10:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190525.1 | Last Updated 6 Apr 2011
Article Copyright 2011 by Pete O'Hanlon
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid