CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: XML

Update AssemblyInfo with MSBuild

807 Views
Copy Code Show/Hide Line Numbers
<PropertyGroup>
    <SolutionRootDir>$(MSBuildProjectDirectory)\..</SolutionRootDir>
    <ApplicationName>MyApp</ApplicationName>
   <Version>0.0.1.0</Version>
    <Company>Active Solution AB</Company>
    <Copyright>Copyright © Active Solution AB 2010</Copyright>
</PropertyGroup>
<PropertyGroup Condition="'$(BUILD_NUMBER)' != ''">
    <Version>$(BUILD_NUMBER)</Version>
</PropertyGroup>
 
<Target Name="UpdateAssemblyInfo">
    <ItemGroup>
    <AllAssemblyInfos Include="$(SolutionRootDir)\**\AssemblyInfo.cs"/>
    </ItemGroup>
    <Attrib Files="@(AllAssemblyInfos)" ReadOnly="false"/>
    <AssemblyInfo AssemblyTitle="" AssemblyProduct="$(ApplicationName)" AssemblyCompany="$(Company)" AssemblyCopyright="$(Copyright)"
                                  ComVisible="false" CLSCompliant="false" CodeLanguage="CS"
                                  AssemblyVersion="$(Version)" AssemblyFileVersion="$(Version)" OutputFile="%(AllAssemblyInfos.FullPath)" />
</Target>
by Petter Wigle
  May 09, 2010 @ 3:13am
Tags:

by Petter Wigle    May 09, 2010 @ 3:27am

If run from TeamCity, the version number is replaced with the TeamCIty build number

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate