Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit eb99d78

Browse files
committed
Revert "Remove versioning/t4.targets from VSIX project"
This reverts commit 4e3b5bf.
1 parent 7f23830 commit eb99d78

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

src/GitHub.VisualStudio.Vsix/GitHub.VisualStudio.Vsix.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,9 @@
344344
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
345345
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != '' And '$(NCrunch)' != '1'" />
346346
<Import Project="packaging.targets" />
347+
<!-- For regenerating templates on build -->
348+
<Import Project="..\common\t4.targets" />
349+
<Import Project="versioning.targets" />
347350
<!--
348351
This is a workaround for allowing neutral CTO resource produced from *.vsct to go in the main assembly.
349352
We move the neutral *.cto file to be categorized as WithCulture=true,Culture=en to prevent the tools from falsely reporting:
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<UsingTask
5+
TaskName="GenerateVersion"
6+
TaskFactory="CodeTaskFactory"
7+
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
8+
9+
<ParameterGroup>
10+
<SolutionInfoFile ParameterType="System.String" Required="true" />
11+
<GeneratedVersion ParameterType="System.String" Output="true" />
12+
</ParameterGroup>
13+
<Task>
14+
<Using Namespace="System" />
15+
<Using Namespace="System.IO" />
16+
<Using Namespace="System.Text.RegularExpressions" />
17+
<Code Type="Fragment" Language="cs">
18+
<![CDATA[
19+
var str = File.ReadAllText(this.SolutionInfoFile);
20+
var regex = new Regex(@"Version = ""([\d]+\.[\d]+\.[\d]+.[\d]+)""");
21+
var v = Version.Parse(regex.Match(str).Groups[1].Value);
22+
this.GeneratedVersion = String.Format("{0}.{1}.{2}.{3}", v.Major, v.Minor, v.Build, DateTimeOffset.UtcNow.ToUnixTimeSeconds());
23+
]]>
24+
</Code>
25+
</Task>
26+
</UsingTask>
27+
28+
<Target Name="GenerateVersionFile"
29+
Condition="$(SkipPackage) != 'Skip'"
30+
AfterTargets="CoreCompile"
31+
Inputs="$(SolutionDir)\src\common\SolutionInfo.cs"
32+
Outputs="$(SolutionDir)\build\version">
33+
<GenerateVersion SolutionInfoFile="$(SolutionDir)\src\common\SolutionInfo.cs">
34+
<Output TaskParameter="GeneratedVersion" PropertyName="GeneratedVersion" />
35+
</GenerateVersion>
36+
37+
<Message Text="Generating file '$(SolutionDir)\build\version' with version '$(GeneratedVersion)'" />
38+
39+
<WriteLinesToFile File="$(SolutionDir)\build\version" Lines="$(GeneratedVersion)" Overwrite="True" />
40+
</Target>
41+
42+
<Target Name="GetBuildVersion" Returns="$(BuildVersion)" DependsOnTargets="GenerateVersionFile">
43+
<ReadLinesFromFile File="$(SolutionDir)\build\version">
44+
<Output TaskParameter="Lines" PropertyName="BuildVersion" />
45+
</ReadLinesFromFile>
46+
</Target>
47+
</Project>

0 commit comments

Comments
 (0)