Skip to content

Commit e435c08

Browse files
authored
Merge pull request #1667 from paulvanbrenk/HelpAboutGeneration
Generate version displayed in Help/About based on Build Number
2 parents 61c14b9 + 5422a65 commit e435c08

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ x64/
3838
*.vspscc
3939
*.vssscc
4040
.builds
41+
GeneratedHelpAboutVersion.cs
4142
#Include the telemetry pdb
4243
!Nodejs/Common/Telemetry/*.*
4344

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<#@ template debug="false" hostspecific="true" language="C#" #>
2+
<#@ parameter type="System.String" name="BuildVersion" #>
3+
<#@ output extension=".cs" #>
4+
//------------------------------------------------------------------------------
5+
// <auto-generated>
6+
// This code was generated by a tool.
7+
// Runtime Version:4.0.30319.42000
8+
//
9+
// Changes to this file may cause incorrect behavior and will be lost if
10+
// the code is regenerated.
11+
// </auto-generated>
12+
//------------------------------------------------------------------------------
13+
using Microsoft.VisualStudio.Shell;
14+
15+
namespace Microsoft.NodejsTools
16+
{
17+
// This attribute is used to register the information needed to show this package
18+
// in the Help/About dialog of Visual Studio.
19+
[InstalledProductRegistration("#110", "#112", "<#= BuildVersion ?? "dev machine" #>", IconResourceID = 400)]
20+
internal sealed partial class NodejsPackage
21+
{
22+
}
23+
}

Nodejs/Product/Nodejs/Nodejs.csproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@
258258
<Compile Include="Commands\OpenReplWindowCommand.cs" />
259259
<Compile Include="Debugger\DebugEngine\AD7EvalErrorProperty.cs" />
260260
<Compile Include="Debugger\NodeDebugProvider.cs" />
261+
<Compile Include="GeneratedHelpAboutVersion.cs">
262+
<AutoGen>True</AutoGen>
263+
<DesignTime>True</DesignTime>
264+
<DependentUpon>GeneratedHelpAboutVersion.tt</DependentUpon>
265+
</Compile>
261266
<Compile Include="ImportWizardResources.Designer.cs">
262267
<AutoGen>True</AutoGen>
263268
<DesignTime>True</DesignTime>
@@ -707,6 +712,10 @@
707712
<TypeScriptProject Include="ProjectTemplates\TypeScriptWebApp\Preview.png" />
708713
<TypeScriptProject Include="ProjectTemplates\TypeScriptWebApp\package.json" />
709714
<TypeScriptProject Include="ProjectTemplates\TypeScriptWebApp\README.md" />
715+
<Content Include="GeneratedHelpAboutVersion.tt">
716+
<Generator>TextTemplatingFileGenerator</Generator>
717+
<LastGenOutput>GeneratedHelpAboutVersion.cs</LastGenOutput>
718+
</Content>
710719
<Content Include="License.html">
711720
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
712721
</Content>
@@ -1189,6 +1198,12 @@
11891198
<InProject>false</InProject>
11901199
</FilesToSign>
11911200
</ItemGroup>
1201+
<ItemGroup>
1202+
<T4ParameterValues Include="BuildVersion">
1203+
<Value>$(VSIXBuildVersion)</Value>
1204+
<Visible>false</Visible>
1205+
</T4ParameterValues>
1206+
</ItemGroup>
11921207
<PropertyGroup>
11931208
<!--
11941209
To specify a different registry root to register your package, uncomment the TargetRegistryRoot
@@ -1203,8 +1218,13 @@
12031218
<CreateVsixContainer>false</CreateVsixContainer>
12041219
<CopyVsixExtensionFiles>false</CopyVsixExtensionFiles>
12051220
</PropertyGroup>
1221+
<PropertyGroup>
1222+
<TransformOnBuild>true</TransformOnBuild>
1223+
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
1224+
</PropertyGroup>
12061225
<Import Project="$(BuildRoot)\Build\Common.Build.CSharp.targets" />
12071226
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
1227+
<Import Project="$(VSToolsPath)\TextTemplating\Microsoft.TextTemplating.targets" />
12081228
<Import Project="..\ProjectAfter.targets" />
12091229
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
12101230
<PropertyGroup>

Nodejs/Product/Nodejs/NodejsPackage.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
1+
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
22

33
using System;
44
using System.Collections.Generic;
@@ -16,15 +16,13 @@
1616
using Microsoft.NodejsTools.Project;
1717
using Microsoft.NodejsTools.ProjectWizard;
1818
using Microsoft.NodejsTools.Repl;
19-
using Microsoft.NodejsTools.Telemetry;
2019
using Microsoft.VisualStudio;
2120
using Microsoft.VisualStudio.ComponentModelHost;
2221
using Microsoft.VisualStudio.Shell;
2322
using Microsoft.VisualStudio.Shell.Interop;
2423
using Microsoft.VisualStudio.Text;
2524
using Microsoft.VisualStudio.Utilities;
2625
using Microsoft.VisualStudioTools;
27-
using Microsoft.VisualStudioTools.Project;
2826

2927
namespace Microsoft.NodejsTools
3028
{
@@ -41,9 +39,6 @@ namespace Microsoft.NodejsTools
4139
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
4240
// a package.
4341
[PackageRegistration(UseManagedResourcesOnly = true)]
44-
// This attribute is used to register the information needed to show this package
45-
// in the Help/About dialog of Visual Studio.
46-
[InstalledProductRegistration("#110", "#112", "1.0.0.0", IconResourceID = 400)]
4742
[Guid(Guids.NodejsPackageString)]
4843
[ProvideOptionPage(typeof(NodejsGeneralOptionsPage), "Node.js Tools", "General", 114, 115, true)]
4944
[ProvideDebugEngine("Node.js Debugging", typeof(AD7ProgramProvider), typeof(AD7Engine), AD7Engine.DebugEngineId, setNextStatement: false, hitCountBp: true, justMyCodeStepping: false)]

0 commit comments

Comments
 (0)