views:

363

answers:

3

When i try to run my MSBuild script for a project before opening it in IDE, I get this error:

"The project file must be opened in the Visual Studio IDE and converted to the latest version before it can be built by MSBuild"

What's the reason i'm getting this error?

+2  A: 

Your solution and/or project files are set for one version of visual studio and MSBuild is building them as a different version. If you look in a solution file you're going to see something like this:

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008

The format version & visual studio # are going to vary based on whether you're using VS2003, VS2005, VS2008 and assumingly VS2010.

On your command line, where you're launching the build, it is launched from a specific version of the .NET framework:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild

Gavin Miller
My .proj is written in vs 2005 and i try to run the MSBuild script from the "v2.0.50727" framework path. Is anything wrong here? When i build the proj first time in IDE and then run the scrit, error goes away.
blntechie
Your IDE is likely updating the project or build files for you, without informing you of that change.
Gavin Miller
+1  A: 

You can use DevEnv.exe from the command line with the /Upgrade switch if you wish to do this as part of some automated process.

jerryjvl
A: 
Lynx Kepler