Last active
August 29, 2015 14:02
-
-
Save JamesWoolfenden/914a206d36d6ab2ab619 to your computer and use it in GitHub Desktop.
Alternate Teamcity friendly auto targets file for the the msbuild extension pack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
This task is based on the AssemblyInfo task written by Neil Enns (http://code.msdn.microsoft.com/AssemblyInfoTaskvers). It is used here with permission. | |
This targets file includes all the necessary information to automatically increment build numbers as part of | |
a regular build process. To use it simply include it in your project file after any other includes. The typical | |
include line looks like this: | |
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.VersionNumber.targets"/> | |
--> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- Properties for controlling the Assembly Version --> | |
<PropertyGroup> | |
<BUILD_NUMBER Condition="$(BUILD_NUMBER)==''">1.0.8888.8888</BUILD_NUMBER> | |
<AssemblyMajorVersion>$(BUILD_NUMBER.Split('.')[0])</AssemblyMajorVersion> | |
<AssemblyMinorVersion>$(BUILD_NUMBER.Split('.')[1])</AssemblyMinorVersion> | |
<AssemblyBuildNumber>$(BUILD_NUMBER.Split('.')[2])</AssemblyBuildNumber> | |
<AssemblyRevision>$(BUILD_NUMBER.Split('.')[3])</AssemblyRevision> | |
</PropertyGroup> | |
<!-- Properties for controlling the Assembly File Version --> | |
<PropertyGroup> | |
<AssemblyFileMajorVersion>$(BUILD_NUMBER.Split('.')[0])</AssemblyFileMajorVersion> | |
<AssemblyFileMinorVersion>$(BUILD_NUMBER.Split('.')[1])</AssemblyFileMinorVersion> | |
<AssemblyFileBuildNumber>$(BUILD_NUMBER.Split('.')[2])</AssemblyFileBuildNumber> | |
<AssemblyFileRevision>$(BUILD_NUMBER.Split('.')[3])</AssemblyFileRevision> | |
</PropertyGroup> | |
<!-- Properties for controlling COM visibility --> | |
<PropertyGroup> | |
<AssemblyComVisible></AssemblyComVisible> | |
<AssemblyGuid></AssemblyGuid> | |
</PropertyGroup> | |
<!-- Propeties for controlling extended assembly attributes --> | |
<PropertyGroup> | |
<AssemblyCompany></AssemblyCompany> | |
<AssemblyConfiguration></AssemblyConfiguration> | |
<AssemblyCopyright>Copyright HCCH © $([System.DateTime]::Now.ToString("yyyy"))</AssemblyCopyright> | |
<AssemblyCulture></AssemblyCulture> | |
<AssemblyDescription></AssemblyDescription> | |
<AssemblyProduct></AssemblyProduct> | |
<AssemblyTitle></AssemblyTitle> | |
</PropertyGroup> | |
<!-- Properties for controlling key signing through assemblyinfo files --> | |
<PropertyGroup> | |
<AssemblyIncludeSigningInformation>false</AssemblyIncludeSigningInformation> | |
<AssemblyDelaySign>false</AssemblyDelaySign> | |
<AssemblyKeyFile></AssemblyKeyFile> | |
<AssemblyKeyName></AssemblyKeyName> | |
</PropertyGroup> | |
<!-- The items that get processed by the task --> | |
<ItemGroup> | |
<AssemblyInfoFiles Include="**\AssemblyInfo.*"/> | |
</ItemGroup> | |
<!-- Import the task --> | |
<UsingTask AssemblyFile="MSBuild.ExtensionPack.dll" TaskName="MSBuild.ExtensionPack.Framework.AssemblyInfo"/> | |
<!-- Re-define CoreCompileDependsOn to ensure the assemblyinfo files are updated before compilation. --> | |
<PropertyGroup> | |
<CoreCompileDependsOn> | |
$(CoreCompileDependsOn); | |
UpdateAssemblyInfoFiles | |
</CoreCompileDependsOn> | |
</PropertyGroup> | |
<!-- The target that actually does all the work. The inputs are the same as the CoreCompileDependsOn target | |
(with the addition of @(AssemblyInfoFiles) to ensure that we only ever update the AssemblyInfo files if a | |
compile is actually going to take place. The outputs are the AssemblyInfoFiles that were passed in for update. --> | |
<Target Name="UpdateAssemblyInfoFiles" | |
Inputs="$(MSBuildAllProjects); | |
@(Compile); | |
@(ManifestResourceWithNoCulture); | |
$(ApplicationIcon); | |
$(AssemblyOriginatorKeyFile); | |
@(ManifestNonResxWithNoCultureOnDisk); | |
@(ReferencePath); | |
@(CompiledLicenseFile); | |
@(EmbeddedDocumentation); | |
@(CustomAdditionalCompileInputs); | |
@(AssemblyInfoFiles)" | |
Outputs="@(AssemblyInfoFiles);@(IntermediateAssembly)"> | |
<AssemblyInfo AssemblyInfoFiles="@(AssemblyInfoFiles)" | |
AssemblyMajorVersion="$(AssemblyMajorVersion)" | |
AssemblyMinorVersion="$(AssemblyMinorVersion)" | |
AssemblyBuildNumber="$(AssemblyBuildNumber)" | |
AssemblyRevision="$(AssemblyRevision)" | |
AssemblyBuildNumberType="$(AssemblyBuildNumberType)" | |
AssemblyBuildNumberFormat="$(AssemblyBuildNumberFormat)" | |
AssemblyRevisionType="$(AssemblyRevisionType)" | |
AssemblyRevisionReset="$(AssemblyRevisionReset)" | |
AssemblyRevisionFormat="$(AssemblyRevisionFormat)" | |
AssemblyFileMajorVersion="$(AssemblyFileMajorVersion)" | |
AssemblyFileMinorVersion="$(AssemblyFileMinorVersion)" | |
AssemblyFileBuildNumber="$(AssemblyFileBuildNumber)" | |
AssemblyFileRevision="$(AssemblyFileRevision)" | |
AssemblyFileBuildNumberType="$(AssemblyFileBuildNumberType)" | |
AssemblyFileBuildNumberFormat="$(AssemblyFileBuildNumberFormat)" | |
AssemblyFileRevisionType="$(AssemblyFileRevisionType)" | |
AssemblyFileRevisionReset="$(AssemblyFileRevisionReset)" | |
AssemblyFileRevisionFormat="$(AssemblyFileRevisionFormat)" | |
ComVisible="$(AssemblyComVisible)" | |
Guid="$(AssemblyGuid)" | |
AssemblyCompany="$(AssemblyCompany)" | |
AssemblyConfiguration="$(AssemblyConfiguration)" | |
AssemblyCopyright="$(AssemblyCopyright)" | |
AssemblyCulture="$(AssemblyCulture)" | |
AssemblyDescription="$(AssemblyDescription)" | |
AssemblyProduct="$(AssemblyProduct)" | |
AssemblyTitle="$(AssemblyTitle)" | |
AssemblyIncludeSigningInformation="$(AssemblyIncludeSigningInformation)" | |
AssemblyDelaySign="$(AssemblyDelaySign)" | |
AssemblyKeyFile="$(AssemblyKeyFile)" | |
AssemblyKeyName="$(AssemblyKeyName)"> | |
<Output TaskParameter="MaxAssemblyVersion" PropertyName="MaxAssemblyVersion"/> | |
<Output TaskParameter="MaxAssemblyFileVersion" PropertyName="MaxAssemblyFileVersion"/> | |
</AssemblyInfo> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment