tags:

views:

94

answers:

2

Hi

Can anyone tell me how to write and run msbuild by using VS 2005?

Thanks

+1  A: 

msbuild file is just a plan text file. you can even write it in notepad and run it from command line. If you would like to run it as part of the build just just

  1. right click on the project
  2. choose Property
  3. goto Build Events tab
  4. create a build event to run msbuild

For example, create a text file called test.proj:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
   <PropertyGroup>
      <TextToShow>Hello World!!</TextToShow>
   </PropertyGroup>

   <Target Name="HelloWorld"> 
      <Message Text="$(TextToShow)" />
   </Target>
</Project>

and you can run it from command line this way

msbuild /target:HelloWorld test.proj
oykuo
A: 

If you want to use MSBuild as the build system for your Visual Studio 2005 projects, you don't have to do anything. .csproj and .vbproj files are MSBuild files. Visual Studio solution files (.sln) can also be passed to MSBuild.exe. Building your project with Visual Studio invokes MSBuild.

If you need to write code that creates, modifies, and runs msbuild files, the Microsoft.Build.*.dll assemblies have classes for that.

Austin