Click here to Skip to main content
Click here to Skip to main content

Creating MSBuild projects from .sln files.

, 6 Apr 2011 CPOL
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.
Follow on   Twitter   Google+

Comments and Discussions

QuestionWorkaround/Update for VS 2013 Pinmembermrchief_200010-Dec-14 10:56 
QuestionNice! Pinmemberdrhender18-Nov-13 7:40 
QuestionIn Application PinmemberÉverton França18-Jul-13 10:15 
AnswerRe: In Application PinprotectorPete O'Hanlon18-Jul-13 10:23 
GeneralUseful! PinmemberBrisingr Aerowing29-Mar-13 15:18 
QuestionNice one! PinmemberXandip27-Sep-12 22:46 
AnswerRe: Nice one! PinmemberMember 947095929-Sep-12 10:39 
next to the solution file, it wil be named .sln.metaproj.
GeneralClean and Simple PinmemberMackZero29-Aug-12 11:36 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150331.1 | Last Updated 6 Apr 2011
Article Copyright 2011 by Pete O'Hanlon
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid