2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

csprojにJenkinsのビルド番号を埋め込む

Last updated at Posted at 2013-07-04

C#のプロジェクトにJenkinsのビルド番号を埋め込む

準備

  • プロジェクトに空のAssemblyFileInfo.csを追加しておく。
  • AssemblyInfo.csからは、 AssemblyFileVersion と AssemblyConfiguration の記述を削除しておく。

csproj に追加

 <PropertyGroup>
    <Major>1</Major>
    <Minor>0</Minor>
    <Build>$(BUILD_NUMBER)</Build>
    <Revision>$(SVN_REVISION)</Revision>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" Condition="Exists('$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets')" />
  <Target Name="BeforeBuild" Condition="Exists('$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets')">
    <Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)" />
    <AssemblyInfo CodeLanguage="CS" OutputFile="AssemblyFileInfo.cs" AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)" AssemblyConfiguration="$(Configuration)" Condition="$(Revision) != '' " />
  </Target>
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?