Thursday, May 5, 2011

MSBuild with Visual studio 2005

Hi

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

Thanks

From stackoverflow
  • 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">
       <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
    
  • 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.

0 comments:

Post a Comment