Skip to content

Instantly share code, notes, and snippets.

@tfwio
Created June 10, 2014 06:03
Show Gist options
  • Save tfwio/740f4800c227b42493d7 to your computer and use it in GitHub Desktop.
Save tfwio/740f4800c227b42493d7 to your computer and use it in GitHub Desktop.
SvnInfo MSBuild ingegration
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("[app_name_here]")]
[assembly: AssemblyDescription("Revision #$WCREV$")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("[app_copyright_info]")]
[assembly: AssemblyProduct("[product_name]")]
[assembly: AssemblyCopyright("[product_copy]")]
[assembly: AssemblyTrademark("[product_trademark]")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
// we assert the SVN_REVISION into the Revision portion here
// for some reason I had placed a zero before the revision number
// so that there were four digits for a revision like '124' to read '0124'.
[assembly: AssemblyVersion("1.0.0.$WCREV$")]
set mpath=%windir%\microsoft.net\framework\v4.0.30319;
set path=%mpath%;%path%
set msb=%mpath%\msbuild
msbuild svninfo.proj /t:build
pause
<?xml version="1.0"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTarget="Build">
<PropertyGroup>
<ProjectDir Condition=" '$(ProjectDir)' == '' ">$(MSBuildProjectDirectory)</ProjectDir>
<SvnToolPath>C:\Program Files\TortoiseSVN\bin</SvnToolPath>
<SvnInfo>$(SvnToolPath)\SubWCRev</SvnInfo>
<PropertiesFile>$(ProjectDir)\Properties\AssemblyInfo.cs</PropertiesFile>
<PropertiesTemplate>$(PropertiesFile).tpl</PropertiesTemplate>
</PropertyGroup>
<Target Name="Build">
<Exec Command="&quot;$(SvnInfo)&quot; &quot;$(ProjectDir)&quot; &quot;$(PropertiesTemplate)&quot; &quot;$(PropertiesFile)&quot; -f" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment