What name do you give the MSBuild project build file

msbuild

I am trying to learn how to use MSBuild so we can use it to build our project. There's what seems to be a very big hole in the documentation, and I find the hole everywhere I look, the hole being how do you name or otherwise designate the MSBuild project file?

For example, the tutorial on MSBuild that can be downloaded from Microsoft goes into some detail on the contents of the build file. For example, here's a little bit of their Hello World project file.

<Project MSBuildVersion = "1.0" DefaultTargets = "Compile">
   <Property appname = "HelloWorldCS"/>
   <Item Type = "CSFile" Include = "consolehwcs1.cs"/>
   <Target Name = "Compile">
      <Task Name = "CSC" Sources = "@(CSFile)">
         <OutputItem  TaskParameter = "OutputAssembly" Type = "EXEFile" Include = "$(appname).exe"/>
      </Task>
      <Message Text="The output file is @(EXEFile)"/>
   </Target>
</Project>

And it goes on blah, blah, blah Items blah blah blah tasks, here's how you do this and here's how you do that. Useless, completely useless. Because they never get around to saying how this xml file is supposed to be recognized by the MSBuild app. Is it supposed to be named in a particular way? Is it supposed to be placed in a particular directory? Both? Neither?

It isn't just the MS tutorial where they don't tell about it. I haven't been able to find it on MSDN, or on any link I can wring out of Groups.Google, either.

Does someone here know? I sure hope so.

Edited to add: I mistook the
.proj file included in the tutorial
to be the .csproj file and that is what
one fed to MSBuild, but it took the answer below before I saw this.
It should have been rather obvious, but I missed it.

Best Answer

You can name the file as you see fit. From the help for MSBuild

msbuild.exe /?

Microsoft (R) Build Engine Version 2.0.50727.3053
[Microsoft .NET Framework, Version 2.0.50727.3053]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Syntax:              MSBuild.exe [options] [project file]

So if you save the file as mybuildfile.xml you would use the syntax:

msbuild.exe mybuildfile.xml
Related Topic