Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild error when building <project> unrecognized

I have installed VS2010. I have a simple .build file which contains this.

<?xml version="1.0"?>
<project name="system" default="build">
    <target name="build">
        <exec program="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe">
            <arg value="C:\System\system.build" />
        </exec>
    </target>
</project>

When I try to build the project by typing C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe system.build, I received this error.

C:\System\system.build(2,1): error MSB4068: The element is unrecognized, or not supported in this context.

I'm interested in recommendations or suggestions.

like image 882
MadeOfStars Avatar asked Apr 21 '26 00:04

MadeOfStars


1 Answers

The reason it doesn't work is you've written the msbuild file almost exactly like you'd write ant/nant. Yes the Project is missing the xmlns tag but every other element is also incorrect. In MSbuild The first letter is always in capitals - Project and nor project. The same goes for all the elements. Like so:

<?xml version="1.0"?>
<Project name="system" default="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="build">
        <MSBuild Project="C:\System\system.build"/>
    </Target>
</Project>
like image 52
James Woolfenden Avatar answered Apr 24 '26 15:04

James Woolfenden