From a1a03b39ffd9ffc1784a53a63ae43cd6e6f00c24 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 9 May 2017 17:09:46 -0700 Subject: [PATCH 1/2] Dynamically generate the version number --- Build/Common.Build.settings | 34 +++++++++++ Build/Common.Build.targets | 1 + Build/fileVersion.targets | 52 +++++++++++++++++ Common/Product/TestAdapter/VisualStudioApp.cs | 2 +- Nodejs/Product/AssemblyInfoCommon.cs | 13 ----- Nodejs/Product/AssemblyVersion.cs | 41 ------------- .../Properties/AssemblyInfo.cs | 2 +- .../source.extension.vsixmanifest | 11 ++-- Nodejs/Product/Nodejs/NodejsPackage.cs | 2 +- .../Product/Nodejs/Properties/AssemblyInfo.cs | 8 +-- .../Nodejs/source.extension.vsixmanifest | 11 ++-- .../Profiling/source.extension.vsixmanifest | 11 ++-- Nodejs/Product/ProjectAfter.settings | 13 ----- .../ProjectWizard/Properties/AssemblyInfo.cs | 13 ----- .../WebRole/Properties/AssemblyInfo.cs | 3 - Nodejs/Setup/BuildRelease.ps1 | 58 ++----------------- 16 files changed, 110 insertions(+), 165 deletions(-) create mode 100644 Build/fileVersion.targets delete mode 100644 Nodejs/Product/AssemblyInfoCommon.cs delete mode 100644 Nodejs/Product/AssemblyVersion.cs diff --git a/Build/Common.Build.settings b/Build/Common.Build.settings index 401eea38c..2abd5228e 100644 --- a/Build/Common.Build.settings +++ b/Build/Common.Build.settings @@ -144,4 +144,38 @@ $(BuildRoot)\Build\xTVS.ruleset + + + 1 + 4 + + + 2016 + + + + + 42.42.42.42 + + + + $([MSBuild]::Subtract($([System.Int32]::Parse($(BUILD_BUILDNUMBER.Substring(0,4)))),$(VersionZeroYear))) + + + + $(MajorVersion).$(MinorVersion).$(VersionCurrentYearOffset)$(BUILD_BUILDNUMBER.Substring(4)) + + + + $(BuildVersion) + $(BuildVersionExtended) commit:$(BUILD_SOURCEVERSION) + + $(BuildVersion) + $(MajorVersion).0.0.0 + diff --git a/Build/Common.Build.targets b/Build/Common.Build.targets index 61731abf8..066c21723 100644 --- a/Build/Common.Build.targets +++ b/Build/Common.Build.targets @@ -3,6 +3,7 @@ + + + + + + + + + <_Parameter1>Microsoft Corporation + + + <_Parameter1>© Microsoft Corporation. All rights reserved. + + + <_Parameter1>$(AssemblyVersion) + + + <_Parameter1>$(BuildVersion) + + + <_Parameter1>$(BuildVersionExtended) + + + + + + + + + + + + \ No newline at end of file diff --git a/Common/Product/TestAdapter/VisualStudioApp.cs b/Common/Product/TestAdapter/VisualStudioApp.cs index d41f4f7b3..47a8ad313 100644 --- a/Common/Product/TestAdapter/VisualStudioApp.cs +++ b/Common/Product/TestAdapter/VisualStudioApp.cs @@ -116,7 +116,7 @@ private static DTE GetDTE(int processId) prefix = "VisualStudio"; } - var progId = $"!{prefix}.DTE.{AssemblyVersionInfo.VSVersion}:{processId}"; + var progId = $"!{prefix}.DTE.15.0:{processId}"; object runningObject = null; IBindCtx bindCtx = null; diff --git a/Nodejs/Product/AssemblyInfoCommon.cs b/Nodejs/Product/AssemblyInfoCommon.cs deleted file mode 100644 index aaaed6073..000000000 --- a/Nodejs/Product/AssemblyInfoCommon.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Reflection; - -// The following assembly information is common to all Node.js Tools for Visual Studio assemblies. -// If you get compiler errors CS0579, "Duplicate '' attribute", check your -// Properties\AssemblyInfo.cs file and remove any lines duplicating the ones below. -// (See also AssemblyVersion.cs in this same directory.) -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Node.js Tools for Visual Studio")] -[assembly: AssemblyCopyright("Copyright \u00A9 Microsoft")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/Nodejs/Product/AssemblyVersion.cs b/Nodejs/Product/AssemblyVersion.cs deleted file mode 100644 index a74e40ea5..000000000 --- a/Nodejs/Product/AssemblyVersion.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Reflection; - -// If you get compiler errors CS0579, "Duplicate '' attribute", check your -// Properties\AssemblyInfo.cs file and remove any lines duplicating the ones below. -// (See also AssemblyInfoCommon.cs in this same directory.) - -#if !SUPPRESS_COMMON_ASSEMBLY_VERSION -[assembly: AssemblyVersion(AssemblyVersionInfo.StableVersion)] -#endif -[assembly: AssemblyFileVersion(AssemblyVersionInfo.Version)] - -internal class AssemblyVersionInfo -{ - // This version string (and the comment for StableVersion) should be - // updated manually between major releases (e.g. from 1.0 to 2.0). - // Servicing branches and minor releases should retain the value. - public const string ReleaseVersion = "1.0"; - - // This version string (and the comment for Version) should be updated - // manually between minor releases (e.g. from 1.0 to 1.1). - // Servicing branches and prereleases should retain the value. - public const string FileVersion = "1.4"; - - // This version should never change from "4100.00"; BuildRelease.ps1 - // will replace it with a generated value. - public const string BuildNumber = "4100.00"; - - public const string VSMajorVersion = "15"; - private const string VSVersionSuffix = "2017"; - - public const string VSVersion = VSMajorVersion + ".0"; - - // Defaults to "1.0.0.(2012|2013|2015)" - public const string StableVersion = ReleaseVersion + ".0." + VSVersionSuffix; - - // Defaults to "1.3.4100.00" - public const string Version = FileVersion + "." + BuildNumber; -} - diff --git a/Nodejs/Product/InteractiveWindow/Properties/AssemblyInfo.cs b/Nodejs/Product/InteractiveWindow/Properties/AssemblyInfo.cs index 5f307478e..733337207 100644 --- a/Nodejs/Product/InteractiveWindow/Properties/AssemblyInfo.cs +++ b/Nodejs/Product/InteractiveWindow/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.InteractiveWindow", CodeBase = "Microsoft.NodejsTools.InteractiveWindow.dll", Version = AssemblyVersionInfo.StableVersion)] +[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.InteractiveWindow", CodeBase = "Microsoft.NodejsTools.InteractiveWindow.dll", Version = "1.0.0.0")] [assembly: NeutralResourcesLanguage("en", UltimateResourceFallbackLocation.Satellite)] [assembly: InternalsVisibleTo("TestUtilities.UI, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("ReplWindowUITests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/Nodejs/Product/InteractiveWindow/source.extension.vsixmanifest b/Nodejs/Product/InteractiveWindow/source.extension.vsixmanifest index fcf6cd64c..cf2cf9fdf 100644 --- a/Nodejs/Product/InteractiveWindow/source.extension.vsixmanifest +++ b/Nodejs/Product/InteractiveWindow/source.extension.vsixmanifest @@ -1,6 +1,6 @@ - + Node.js Tools - Interactive Window Node.js Tools - Interactive Window. http://go.microsoft.com/fwlink/?LinkId=785971 @@ -13,12 +13,9 @@ Id specifications are minimums; any SKU equal or 'higher' will accept them. --> - - - - - - + + + diff --git a/Nodejs/Product/Nodejs/NodejsPackage.cs b/Nodejs/Product/Nodejs/NodejsPackage.cs index e35ccddd7..5ab422f94 100644 --- a/Nodejs/Product/Nodejs/NodejsPackage.cs +++ b/Nodejs/Product/Nodejs/NodejsPackage.cs @@ -45,7 +45,7 @@ namespace Microsoft.NodejsTools [PackageRegistration(UseManagedResourcesOnly = true)] // This attribute is used to register the information needed to show this package // in the Help/About dialog of Visual Studio. - [InstalledProductRegistration("#110", "#112", AssemblyVersionInfo.Version, IconResourceID = 400)] + [InstalledProductRegistration("#110", "#112", "1.0.0.0", IconResourceID = 400)] [Guid(Guids.NodejsPackageString)] [ProvideOptionPage(typeof(NodejsGeneralOptionsPage), "Node.js Tools", "General", 114, 115, true)] [ProvideOptionPage(typeof(NodejsNpmOptionsPage), "Node.js Tools", "Npm", 114, 116, true)] diff --git a/Nodejs/Product/Nodejs/Properties/AssemblyInfo.cs b/Nodejs/Product/Nodejs/Properties/AssemblyInfo.cs index 33227bef7..f1236ff8c 100644 --- a/Nodejs/Product/Nodejs/Properties/AssemblyInfo.cs +++ b/Nodejs/Product/Nodejs/Properties/AssemblyInfo.cs @@ -17,11 +17,11 @@ [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] [assembly: NeutralResourcesLanguage("en", UltimateResourceFallbackLocation.Satellite)] -[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools", CodeBase = "Microsoft.NodejsTools.dll", Version = AssemblyVersionInfo.StableVersion)] -[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.Npm", CodeBase = "Microsoft.NodejsTools.Npm.dll", Version = AssemblyVersionInfo.StableVersion)] -[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.PressAnyKey", CodeBase = "Microsoft.NodejsTools.PressAnyKey.exe", Version = AssemblyVersionInfo.StableVersion)] +[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools", CodeBase = "Microsoft.NodejsTools.dll", Version = "1.0.0.0")] +[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.Npm", CodeBase = "Microsoft.NodejsTools.Npm.dll", Version = "1.0.0.0")] +[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.PressAnyKey", CodeBase = "Microsoft.NodejsTools.PressAnyKey.exe", Version = "1.0.0.0")] [assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.ProjectWizard", CodeBase = "Microsoft.NodejsTools.ProjectWizard.dll", Version = "1.0.0.0")] -[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.TestAdapter", CodeBase = "Microsoft.NodejsTools.TestAdapter.dll", Version = AssemblyVersionInfo.StableVersion)] +[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.TestAdapter", CodeBase = "Microsoft.NodejsTools.TestAdapter.dll", Version = "1.0.0.0")] [assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.Telemetry.15.0", CodeBase = "Microsoft.NodejsTools.Telemetry.15.0.dll", Version = "15.0.1.0")] [assembly: InternalsVisibleTo("TestUtilities.NodeJS, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/Nodejs/Product/Nodejs/source.extension.vsixmanifest b/Nodejs/Product/Nodejs/source.extension.vsixmanifest index 4ba4ff332..3646d38ea 100644 --- a/Nodejs/Product/Nodejs/source.extension.vsixmanifest +++ b/Nodejs/Product/Nodejs/source.extension.vsixmanifest @@ -1,6 +1,6 @@ - + Node.js Tools Provides support for editing and debugging Node.js programs. http://go.microsoft.com/fwlink/?LinkId=785971 @@ -10,12 +10,9 @@ Microsoft.VisualStudio.NodejsTools.NodejsTools - - - - - - + + + diff --git a/Nodejs/Product/Profiling/source.extension.vsixmanifest b/Nodejs/Product/Profiling/source.extension.vsixmanifest index 557f68e83..4685055d3 100644 --- a/Nodejs/Product/Profiling/source.extension.vsixmanifest +++ b/Nodejs/Product/Profiling/source.extension.vsixmanifest @@ -1,6 +1,6 @@ - + Node.js Tools - Profiling Provides support for profiling Node.js projects http://go.microsoft.com/fwlink/?LinkId=785971 @@ -13,12 +13,9 @@ Id specifications are minimums; any SKU equal or 'higher' will accept them. --> - - - - - - + + + diff --git a/Nodejs/Product/ProjectAfter.settings b/Nodejs/Product/ProjectAfter.settings index f3c0ffdbb..fdac28151 100644 --- a/Nodejs/Product/ProjectAfter.settings +++ b/Nodejs/Product/ProjectAfter.settings @@ -1,16 +1,3 @@ - - - - - AssemblyInfoCommon.cs - - - AssemblyVersion.cs - - - - - diff --git a/Nodejs/Product/ProjectWizard/Properties/AssemblyInfo.cs b/Nodejs/Product/ProjectWizard/Properties/AssemblyInfo.cs index af5f5b31d..7f2f01b9e 100644 --- a/Nodejs/Product/ProjectWizard/Properties/AssemblyInfo.cs +++ b/Nodejs/Product/ProjectWizard/Properties/AssemblyInfo.cs @@ -19,16 +19,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("dfdf8c10-b0c5-43d5-8ab6-833523131644")] [assembly: NeutralResourcesLanguage("en", UltimateResourceFallbackLocation.Satellite)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] // Version is fixed so we can refer to it from .vstemplate files - diff --git a/Nodejs/Product/WebRole/Properties/AssemblyInfo.cs b/Nodejs/Product/WebRole/Properties/AssemblyInfo.cs index 4154976ec..9ce16dd15 100644 --- a/Nodejs/Product/WebRole/Properties/AssemblyInfo.cs +++ b/Nodejs/Product/WebRole/Properties/AssemblyInfo.cs @@ -17,6 +17,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("A87D74DE-BD73-4FDF-9D76-06D2C76F2460")] - - - diff --git a/Nodejs/Setup/BuildRelease.ps1 b/Nodejs/Setup/BuildRelease.ps1 index e77b40e94..46500c0c3 100644 --- a/Nodejs/Setup/BuildRelease.ps1 +++ b/Nodejs/Setup/BuildRelease.ps1 @@ -6,8 +6,8 @@ This script is used to build a set of installers for Node.js Tools for Visual Studio based on the code in this branch. - The assembly and file versions are generated automatically and provided by - modifying .\Build\AssemblyVersion.cs. + The assembly and file versions are generated automatically by the + fileVersion.targets import. The source is determined from the location of this script; to build another branch, use its Copy-Item of BuildRelease.ps1. @@ -144,9 +144,6 @@ $base_year = 2016 # This value is used to automatically generate outdir for -release and -internal builds $base_outdir = "\\pytools\Release\Nodejs" -# This file is parsed to find version information -$version_file = gi "$buildroot\Nodejs\Product\AssemblyVersion.cs" - $build_project = gi "$buildroot\Nodejs\dirs.proj" $setup_swix_project = gi "$buildroot\Nodejs\Setup\setup-swix.proj" @@ -188,7 +185,6 @@ function msbuild-exe($target) { # VSTarget e.g. 14.0 # VSName e.g. VS 2013 # config Name of the build configuration -# msi_version X.Y.Z.W installer version # release_version X.Y install version # assembly_version X.Y.Z assembly version # logfile Build log file @@ -210,8 +206,6 @@ function msbuild-options($target) { "/p:VisualStudioVersion=$($target.VSTarget)", "/p:CopyOutputsToPath=$($target.destdir)", "/p:Configuration=$($target.config)", - "/p:MsiVersion=$($target.msi_version)", - "/p:ReleaseVersion=$($target.release_version)", "/p:DevEnvDir=$($target.vsroot)\Common7\IDE\\" ) } @@ -399,20 +393,7 @@ if ($name) { Throw "'-name [build name]' must be specified when using '-internal'" } -$version_file_backed_up = 0 -# Force use of a backup if there are pending changes to $version_file -$version_file_force_backup = 0 -$has_tf_workspace = (Get-Command tf -errorAction SilentlyContinue) -and (-not (tf workspaces | Select-String -pattern "No workspace", "Unable to determine the workspace")) -if ($has_tf_workspace) { - if (-not (tf status $version_file /format:detailed | Select-String "There are no pending changes.")) { - Write-Output "$version_file has pending changes. Using backup instead of tf undo." - $version_file_force_backup = 1 - } -} -$version_file_is_readonly = $version_file.Attributes -band [io.FileAttributes]::ReadOnly - -$assembly_version = [regex]::Match((Get-Content $version_file), 'ReleaseVersion = "([0-9.]+)";').Groups[1].Value -$release_version = [regex]::Match((Get-Content $version_file), 'FileVersion = "([0-9.]+)";').Groups[1].Value +$release_version = "42.42.42.42" if ($internal) { $base_outdir = "$base_outdir\Internal\$name" @@ -450,8 +431,6 @@ if ([int]::Parse([regex]::Match($buildnumber, '^[0-9]+').Value) -ge 65535) { (If the year is not yet $($base_year + 7) then something else has gone wrong.)" } -$msi_version = "$release_version.$buildnumber" - if ($internal -or $release -or $mockrelease) { if (-not $serverBuildNumber) { @@ -481,8 +460,6 @@ if ($mockrelease) { Write-Output "Auto-generated release outdir: $outdir" } Write-Output "" -Write-Output "Product version: $assembly_version.`$(VS version)" -Write-Output "MSI version: $msi_version" Write-Output "Building for $([String]::Join(", ", ($target_versions | % { $_.name })))" Write-Output "============================================================" Write-Output "" @@ -510,16 +487,6 @@ $failed_logs = @() Push-Location $buildroot try { $successful = $false - if ((-not $version_file_force_backup) -and $has_tf_workspace) { - tf edit $version_file | Out-Null - } - if ($version_file_force_backup -or -not $?) { - # running outside of MS - Copy-Item -Force $version_file "$($version_file).bak" - $version_file_backed_up = 1 - } - Set-ItemProperty $version_file -Name IsReadOnly -Value $false - (Get-Content $version_file) | %{ $_ -replace ' = "4100.00"', (' = "' + $buildnumber + '"') } | Set-Content $version_file foreach ($config in $target_configs) { # See the description near the msbuild_config function @@ -530,7 +497,6 @@ try { destdir=mkdir "$outdir\$($_.name)\$config" -Force; logfile="$logdir\BuildRelease.$config.$($_.number).log"; config=$config; - msi_version=$msi_version; release_version=$release_version; vsroot=$($_.vsroot) } @@ -725,23 +691,7 @@ try { $successful = $true } finally { - try { - if ($version_file_backed_up) { - Move-Item "$version_file.bak" $version_file -Force - if ($version_file_is_readonly) { - Set-ItemProperty $version_file -Name IsReadOnly -Value $true - } - Write-Output "Restored $version_file" - } elseif ((-not $version_file_force_backup) -and $has_tf_workspace) { - tf undo /noprompt $version_file | Out-Null - } - - if (-not (Get-Content $version_file) -match ' = "4100.00"') { - Write-Error "Failed to undo $version_file" - } - } finally { - Pop-Location - } + Pop-Location } if ($successful) { From 5dc77373c906f5a6f23760ac505983afc238726c Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 9 May 2017 17:32:15 -0700 Subject: [PATCH 2/2] Update Profiling assemblies to use the hardcoded assembly version --- Nodejs/Product/Profiling/NodejsProfilingPackage.cs | 2 +- Nodejs/Product/Profiling/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Nodejs/Product/Profiling/NodejsProfilingPackage.cs b/Nodejs/Product/Profiling/NodejsProfilingPackage.cs index 73e8adb9e..a936972d1 100644 --- a/Nodejs/Product/Profiling/NodejsProfilingPackage.cs +++ b/Nodejs/Product/Profiling/NodejsProfilingPackage.cs @@ -35,7 +35,7 @@ namespace Microsoft.NodejsTools.Profiling [Description("Node.js Tools Profiling Package")] // This attribute is used to register the informations needed to show the this package // in the Help/About dialog of Visual Studio. - [InstalledProductRegistration("#110", "#112", AssemblyVersionInfo.Version, IconResourceID = 400)] + [InstalledProductRegistration("#110", "#112", "1.0.0.0", IconResourceID = 400)] // This attribute is needed to let the shell know that this package exposes some menus. [ProvideMenuResource("Menus.ctmenu", 1)] [Guid(ProfilingGuids.NodejsProfilingPkgString)] diff --git a/Nodejs/Product/Profiling/Properties/AssemblyInfo.cs b/Nodejs/Product/Profiling/Properties/AssemblyInfo.cs index 215f63364..c89cba328 100644 --- a/Nodejs/Product/Profiling/Properties/AssemblyInfo.cs +++ b/Nodejs/Product/Profiling/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.Profiling", CodeBase = "Microsoft.NodejsTools.Profiling.dll", Version = AssemblyVersionInfo.StableVersion)] +[assembly: ProvideCodeBase(AssemblyName = "Microsoft.NodejsTools.Profiling", CodeBase = "Microsoft.NodejsTools.Profiling.dll", Version = "1.0.0.0")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from