Skip to content

Commit da8a376

Browse files
authored
Fix handling of NuGet package version in VSIX (#1536)
* Allow vsix to have prerelease nupkg * Fix nuget template invocation * Missed one case of NuGet vs VSIX version
1 parent 1a5cd65 commit da8a376

File tree

13 files changed

+35
-26
lines changed

13 files changed

+35
-26
lines changed

.pipelines/OneBranch.Official.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ parameters: # parameters are shown up in ADO UI in a build queue time
66

77
variables:
88
- template: variables/version.yml
9+
parameters:
10+
OfficialBuild: true
911
- template: variables/OneBranchVariables.yml
1012
parameters:
1113
debug: ${{ parameters.debug }}
@@ -132,8 +134,7 @@ extends:
132134
jobs:
133135
- template: .pipelines/jobs/OneBranchNuGet.yml@self
134136
parameters:
135-
BuildConfiguration: $(BuildConfiguration)
136-
BuildVersion: $(BuildVersion)
137+
NugetPackageVersion: $(NugetPackageVersion)
137138
OfficialBuild: true
138139

139140
- stage: Test
@@ -151,4 +152,5 @@ extends:
151152
parameters:
152153
BuildConfiguration: $(BuildConfiguration)
153154
BuildVersion: $(BuildVersion)
155+
NugetPackageVersion: $(NugetPackageVersion)
154156
OfficialBuild: true

.pipelines/OneBranch.PullRequest.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extends:
5656
- template: .pipelines/jobs/OneBranchNuGet.yml@self
5757
parameters:
5858
BuildConfiguration: $(BuildConfiguration)
59-
BuildVersion: $(BuildVersion)
59+
NugetPackageVersion: $(NugetPackageVersion)
6060

6161
- stage: Test
6262
dependsOn: build
@@ -73,3 +73,4 @@ extends:
7373
parameters:
7474
BuildConfiguration: $(BuildConfiguration)
7575
BuildVersion: $(BuildVersion)
76+
NugetPackageVersion: $(NugetPackageVersion)

.pipelines/jobs/OneBranchNuGet.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
parameters:
33
- name: BuildConfiguration
44
type: string
5-
- name: BuildVersion
5+
- name: NugetPackageVersion
66
type: string
77
- name: OfficialBuild
88
type: boolean
@@ -15,10 +15,7 @@ jobs:
1515

1616
variables:
1717
ob_outputDirectory: '$(Build.SourcesDirectory)\out'
18-
${{ if eq(parameters.OfficialBuild, true) }}:
19-
PackageVersion: ${{ parameters.BuildVersion }}
20-
${{ else }}:
21-
PackageVersion: ${{ parameters.BuildVersion }}-unofficial
18+
PackageVersion: ${{ parameters.NugetPackageVersion }}
2219

2320
ob_sdl_prefast_enabled: true
2421
ob_sdl_prefast_runDuring: 'Guardian'

.pipelines/jobs/OneBranchVsix.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ parameters:
33
type: string
44
- name: BuildVersion
55
type: string
6+
- name: NugetPackageVersion
7+
type: string
68
- name: OfficialBuild
79
type: boolean
810
default: false
@@ -27,11 +29,6 @@ jobs:
2729
VsixFilename: Microsoft.Windows.CppWinRT
2830

2931
variables:
30-
${{ if eq(parameters.OfficialBuild, true) }}:
31-
PackageVersion: ${{ parameters.BuildVersion }}
32-
${{ else }}:
33-
PackageVersion: ${{ parameters.BuildVersion }}-unofficial
34-
3532
ob_outputDirectory: $(Build.SourcesDirectory)\out
3633
ob_artifactSuffix: $(VsVersion)_$(Deployment)
3734

@@ -96,7 +93,7 @@ jobs:
9693
displayName: Build VSIX
9794
inputs:
9895
solution: $(Build.SourcesDirectory)\vsix\vsix.sln
99-
msbuildArgs: /t:vsix_$(VsVersion) /m /p:CppWinRTVersion=$(PackageVersion),clean_intermediate_files=true,Deployment=$(Deployment),NatvisDirx86=$(Build.SourcesDirectory)\x86\$(Deployment)\,NatvisDirx64=$(Build.SourcesDirectory)\x64\$(Deployment)\,NatvisDirarm64=$(Build.SourcesDirectory)\arm64\$(Deployment)\,NupkgDir=$(Pipeline.Workspace)\nuget\packages /bl:$(ob_outputDirectory)\output.binlog
96+
msbuildArgs: /t:vsix_$(VsVersion) /m /p:CppWinRTVersion=${{ parameters.BuildVersion }},NugetPackageVersion=${{ parameters.NugetPackageVersion }},clean_intermediate_files=true,Deployment=$(Deployment),NatvisDirx86=$(Build.SourcesDirectory)\x86\$(Deployment)\,NatvisDirx64=$(Build.SourcesDirectory)\x64\$(Deployment)\,NatvisDirarm64=$(Build.SourcesDirectory)\arm64\$(Deployment)\,NupkgDir=$(Pipeline.Workspace)\nuget\packages /bl:$(ob_outputDirectory)\output.binlog
10097
platform: 'Any CPU'
10198
configuration: ${{ parameters.BuildConfiguration }}
10299

.pipelines/variables/version.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
parameters:
2+
- name: OfficialBuild
3+
type: boolean
4+
default: false
5+
16
variables:
27
MajorVersion: "2"
38
MinorVersion: "0"
49
VersionDate: $[format('{0:yyMMdd}', pipeline.startTime)]
510
VersionCounter: $[counter(variables['VersionDate'], 1)]
611
BuildVersion: $(MajorVersion).$(MinorVersion).$(VersionDate).$(VersionCounter)
7-
PatchVersion: $(VersionDate)$(VersionCounter)
12+
PatchVersion: $(VersionDate)$(VersionCounter)
13+
14+
${{ if eq(parameters.OfficialBuild, true) }}:
15+
NugetPackageVersion: $(BuildVersion)
16+
${{ else }}:
17+
NugetPackageVersion: $(BuildVersion)-unofficial

build_vsix.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ call msbuild /p:Configuration=%target_configuration%,Platform=x86,Deployment=%ta
3030
call msbuild /p:Configuration=%target_configuration%,Platform=arm64,Deployment=%target_deployment%,CppWinRTBuildVersion=%target_version% natvis\cppwinrtvisualizer.sln
3131

3232
rem Build nuget
33-
.nuget\nuget.exe pack nuget\Microsoft.Windows.CppWinRT.nuspec -NonInteractive -OutputDirectory %this_dir%_build -Properties Configuration=%target_configuration%;cppwinrt_exe=%this_dir%_build\x86\%target_configuration%\cppwinrt.exe;cppwinrt_fast_fwd_x86=%this_dir%_build\x86\%target_configuration%\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%this_dir%_build\x64\%target_configuration%\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%this_dir%_build\arm64\%target_configuration%\cppwinrt_fast_forwarder.lib -version %target_version% -Verbosity Detailed
33+
.nuget\nuget.exe pack nuget\Microsoft.Windows.CppWinRT.nuspec -NonInteractive -OutputDirectory %this_dir%_build -Properties Configuration=%target_configuration%;cppwinrt_exe=%this_dir%_build\x86\%target_configuration%\cppwinrt.exe;cppwinrt_fast_fwd_x86=%this_dir%_build\x86\%target_configuration%\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%this_dir%_build\x64\%target_configuration%\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%this_dir%_build\arm64\%target_configuration%\cppwinrt_fast_forwarder.lib;target_version=%target_version% -version %target_version% -Verbosity Detailed
3434

3535
rem Build vsix
36-
call msbuild /restore /p:Configuration=%target_configuration%,Platform="Any CPU",Deployment=%target_deployment%,CppWinRTVersion=%target_version%,NatvisDirx86=%this_dir%natvis\x86\%target_configuration%\%target_deployment%,NatvisDirx64=%this_dir%natvis\x64\%target_configuration%\%target_deployment%,NatvisDirarm64=%this_dir%natvis\arm64\%target_configuration%\%target_deployment%,NupkgDir=%this_dir%_build vsix\vsix.sln
36+
call msbuild /restore /p:Configuration=%target_configuration%,Platform="Any CPU",Deployment=%target_deployment%,CppWinRTVersion=%target_version%,NugetPackageVersion=%target_version%,NatvisDirx86=%this_dir%natvis\x86\%target_configuration%\%target_deployment%,NatvisDirx64=%this_dir%natvis\x64\%target_configuration%\%target_deployment%,NatvisDirarm64=%this_dir%natvis\arm64\%target_configuration%\%target_deployment%,NupkgDir=%this_dir%_build vsix\vsix.sln

vsix/Dev16/Component/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<Asset Type="DebuggerEngineExtension" Path="CppWinrtVisualizer.vsdconfig" />
3030
<Asset Type="Microsoft.VisualStudio.ItemTemplate" Path="ItemTemplates" />
3131
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" Path="ProjectTemplates" />
32-
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" VsixSubPath="Packages" />
32+
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetNugetPackageVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetNugetPackageVersion|.nupkg" VsixSubPath="Packages" />
3333
</Assets>
3434
<Prerequisites>
3535
<Prerequisite Id="Microsoft.VisualStudio.Component.VC.CoreBuildTools" Version="[16.0,18.0)" DisplayName="CppWinRT" />

vsix/Dev16/Standalone/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<Asset Type="DebuggerEngineExtension" Path="CppWinrtVisualizer.vsdconfig" />
3030
<Asset Type="Microsoft.VisualStudio.ItemTemplate" Path="ItemTemplates" />
3131
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" Path="ProjectTemplates" />
32-
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" VsixSubPath="Packages" />
32+
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetNugetPackageVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetNugetPackageVersion|.nupkg" VsixSubPath="Packages" />
3333
</Assets>
3434
<Prerequisites>
3535
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[16.0,)" DisplayName="Visual Studio core editor" />

vsix/Dev16/vsix.Dev16.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
<Link>%(Filename)%(Extension)</Link>
4242
<IncludeInVSIX>true</IncludeInVSIX>
4343
</Content>
44-
<Content Include="$(NupkgDir)\Microsoft.Windows.CppWinRT.$(CppWinRTVersion).nupkg">
45-
<Link>Packages\Microsoft.Windows.CppWinRT.$(CppWinRTVersion).nupkg</Link>
44+
<Content Include="$(NupkgDir)\Microsoft.Windows.CppWinRT.$(NugetPackageVersion).nupkg">
45+
<Link>Packages\Microsoft.Windows.CppWinRT.$(NugetPackageVersion).nupkg</Link>
4646
<IncludeInVSIX>true</IncludeInVSIX>
4747
</Content>
4848
<Content Include="$(VSIXRootDir)..\natvis\cppwinrt.natvis">

vsix/Dev17/Component/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<Asset Type="DebuggerEngineExtension" Path="CppWinrtVisualizer.vsdconfig" />
3636
<Asset Type="Microsoft.VisualStudio.ItemTemplate" Path="ItemTemplates" />
3737
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" Path="ProjectTemplates" />
38-
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" VsixSubPath="Packages" />
38+
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetNugetPackageVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetNugetPackageVersion|.nupkg" VsixSubPath="Packages" />
3939
</Assets>
4040
<Prerequisites>
4141
<Prerequisite Id="Microsoft.VisualStudio.Component.VC.CoreBuildTools" Version="[17.0,18.0)" DisplayName="CppWinRT" />

0 commit comments

Comments
 (0)