Skip to content

Commit 5311393

Browse files
authored
Merge pull request #1461 from microsoft/dev/andarno/libtemplateUpdate
Merge latest Library.Template
2 parents 4c0b6e1 + 84b17dd commit 5311393

11 files changed

Lines changed: 161 additions & 32 deletions

File tree

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"powershell": {
6-
"version": "7.5.0",
6+
"version": "7.5.1",
77
"commands": [
88
"pwsh"
99
],

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions
2-
FROM mcr.microsoft.com/dotnet/sdk:9.0.203-noble@sha256:2c9a4956a61fc45d9111fb36ec9fb86932e4842af9eb9bc9306bf8757f53674d
2+
FROM mcr.microsoft.com/dotnet/sdk:9.0.300-noble@sha256:9f7bd4d010026e15a57d9cf876f2f7d08c3eeed6a0ea987b8c5ba8c75e68e948
33

44
# Installing mono makes `dotnet test` work without errors even for net472.
55
# But installing it takes a long time, so it's excluded by default.

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<BaseOutputPath Condition=" '$(BaseOutputPath)' == '' ">$(RepoRootPath)bin\$(MSBuildProjectName)\</BaseOutputPath>
88
<PackageOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\NuGet\</PackageOutputPath>
99
<VSIXOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\Vsix\$(Platform)\</VSIXOutputPath>
10+
<SBOMFileDestPath>$(VSIXOutputPath)</SBOMFileDestPath>
1011
<Nullable>enable</Nullable>
1112
<ImplicitUsings>disable</ImplicitUsings>
1213
<AnalysisLevel>latest</AnalysisLevel>

Directory.Packages.props

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
<PackageVersion Update="Microsoft.CodeAnalysis.VisualBasic" Version="$(CodeAnalysisVersionForTests)" />
5050
</ItemGroup>
5151
<ItemGroup Label="Library.Template">
52-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
52+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
5353
<PackageVersion Include="Microsoft.VisualStudio.Internal.MicroBuild.NonShipping" Version="$(MicroBuildVersion)" />
54-
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
54+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.0" />
5555
<PackageVersion Include="xunit" Version="2.9.3" />
5656
</ItemGroup>
5757
<ItemGroup>
@@ -61,7 +61,8 @@
6161
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.593" />
6262
<GlobalPackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
6363
<GlobalPackageReference Include="Microsoft.VisualStudio.Internal.MicroBuild.VisualStudio" Version="$(MicroBuildVersion)" />
64-
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" />
64+
<!-- The condition works around https://github.com/dotnet/sdk/issues/44951 -->
65+
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" Condition="!('$(TF_BUILD)'=='true' and '$(dotnetformat)'=='true')" />
6566
<GlobalPackageReference Include="PolySharp" Version="1.15.0" />
6667
<GlobalPackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" />
6768
</ItemGroup>

SUPPORT.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Support
2+
3+
## How to file issues and get help
4+
5+
This project uses GitHub Issues to track bugs and feature requests.
6+
Please search the existing issues before filing new issues to avoid duplicates.
7+
For new issues, file your bug or feature request as a new Issue.
8+
9+
Note that this repo is primarily used for Visual Studio and related products and support will be focused on those scenarios.
10+
11+
## Microsoft Support Policy
12+
13+
Microsoft support for this software is available only for its use in officially supported products such as Visual Studio.
14+
Support and servicing is limited to the latest released version.
15+
For more information, see [Visual Studio Product Lifecycle and Servicing](https://learn.microsoft.com/visualstudio/productinfo/vs-servicing).
16+
Assisted support is available from a professional support engineer by opening a ticket with the [Microsoft assisted support team](https://support.serviceshub.microsoft.com/supportforbusiness/onboarding).

azure-pipelines/build.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ jobs:
198198
IsOptProf: ${{ parameters.IsOptProf }}
199199

200200
- ${{ if and(parameters.EnableDotNetFormatCheck, not(parameters.EnableLinuxBuild)) }}:
201-
- script: dotnet format --verify-no-changes --no-restore
201+
- script: dotnet format --verify-no-changes
202202
displayName: 💅 Verify formatted code
203+
env:
204+
dotnetformat: true # part of a workaround for https://github.com/dotnet/sdk/issues/44951
203205

204206
- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}:
205207
- template: microbuild.after.yml
@@ -238,8 +240,10 @@ jobs:
238240
Is1ESPT: ${{ parameters.Is1ESPT }}
239241
RunTests: ${{ parameters.RunTests }}
240242
- ${{ if parameters.EnableDotNetFormatCheck }}:
241-
- script: dotnet format --verify-no-changes --no-restore
243+
- script: dotnet format --verify-no-changes
242244
displayName: 💅 Verify formatted code
245+
env:
246+
dotnetformat: true # part of a workaround for https://github.com/dotnet/sdk/issues/44951
243247

244248
- ${{ if parameters.EnableMacOSBuild }}:
245249
- job: macOS
@@ -279,6 +283,8 @@ jobs:
279283
- macOS
280284
pool: ${{ parameters.windowsPool }} # Use Windows agent because PublishSymbols task requires it (https://github.com/microsoft/azure-pipelines-tasks/issues/13821).
281285
condition: succeededOrFailed()
286+
variables:
287+
ONEES_ENFORCED_CODEQL_ENABLED: false # CodeQL runs on build jobs, we don't need it here
282288
${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}:
283289
templateContext:
284290
${{ if not(parameters.RealSign) }}:

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "9.0.203",
3+
"version": "9.0.300",
44
"rollForward": "patch",
55
"allowPrerelease": false
66
},

tools/Get-3rdPartySymbolFiles.ps1

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
Function Get-FileFromWeb([Uri]$Uri, $OutFile) {
2+
$OutDir = Split-Path $OutFile
3+
if (!(Test-Path $OutFile)) {
4+
Write-Verbose "Downloading $Uri..."
5+
if (!(Test-Path $OutDir)) { New-Item -ItemType Directory -Path $OutDir | Out-Null }
6+
try {
7+
(New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile)
8+
}
9+
finally {
10+
# This try/finally causes the script to abort
11+
}
12+
}
13+
}
14+
15+
Function Unzip($Path, $OutDir) {
16+
$OutDir = (New-Item -ItemType Directory -Path $OutDir -Force).FullName
17+
Add-Type -AssemblyName System.IO.Compression.FileSystem
18+
19+
# Start by extracting to a temporary directory so that there are no file conflicts.
20+
[System.IO.Compression.ZipFile]::ExtractToDirectory($Path, "$OutDir.out")
21+
22+
# Now move all files from the temp directory to $OutDir, overwriting any files.
23+
Get-ChildItem -Path "$OutDir.out" -Recurse -File | ForEach-Object {
24+
$destinationPath = Join-Path -Path $OutDir -ChildPath $_.FullName.Substring("$OutDir.out".Length).TrimStart([io.path]::DirectorySeparatorChar, [io.path]::AltDirectorySeparatorChar)
25+
if (!(Test-Path -Path (Split-Path -Path $destinationPath -Parent))) {
26+
New-Item -ItemType Directory -Path (Split-Path -Path $destinationPath -Parent) | Out-Null
27+
}
28+
Move-Item -Path $_.FullName -Destination $destinationPath -Force
29+
}
30+
Remove-Item -Path "$OutDir.out" -Recurse -Force
31+
}
32+
33+
Function Get-SymbolsFromPackage($id, $version) {
34+
$symbolPackagesPath = "$PSScriptRoot/../obj/SymbolsPackages"
35+
New-Item -ItemType Directory -Path $symbolPackagesPath -Force | Out-Null
36+
$nupkgPath = Join-Path $symbolPackagesPath "$id.$version.nupkg"
37+
$snupkgPath = Join-Path $symbolPackagesPath "$id.$version.snupkg"
38+
$unzippedPkgPath = Join-Path $symbolPackagesPath "$id.$version"
39+
Get-FileFromWeb -Uri "https://www.nuget.org/api/v2/package/$id/$version" -OutFile $nupkgPath
40+
Get-FileFromWeb -Uri "https://www.nuget.org/api/v2/symbolpackage/$id/$version" -OutFile $snupkgPath
41+
42+
Unzip -Path $nupkgPath -OutDir $unzippedPkgPath
43+
Unzip -Path $snupkgPath -OutDir $unzippedPkgPath
44+
45+
Get-ChildItem -Recurse -LiteralPath $unzippedPkgPath -Filter *.pdb | % {
46+
# Collect the DLLs/EXEs as well.
47+
$rootName = Join-Path $_.Directory $_.BaseName
48+
if ($rootName.EndsWith('.ni')) {
49+
$rootName = $rootName.Substring(0, $rootName.Length - 3)
50+
}
51+
52+
$dllPath = "$rootName.dll"
53+
$exePath = "$rootName.exe"
54+
if (Test-Path $dllPath) {
55+
$BinaryImagePath = $dllPath
56+
}
57+
elseif (Test-Path $exePath) {
58+
$BinaryImagePath = $exePath
59+
}
60+
else {
61+
Write-Warning "`"$_`" found with no matching binary file."
62+
$BinaryImagePath = $null
63+
}
64+
65+
if ($BinaryImagePath) {
66+
Write-Output $BinaryImagePath
67+
Write-Output $_.FullName
68+
}
69+
}
70+
}
71+
72+
Function Get-PackageVersion($id) {
73+
$versionProps = [xml](Get-Content -LiteralPath $PSScriptRoot\..\Directory.Packages.props)
74+
$version = $versionProps.Project.ItemGroup.PackageVersion | ? { $_.Include -eq $id } | % { $_.Version }
75+
if (!$version) {
76+
Write-Error "No package version found in Directory.Packages.props for the package '$id'"
77+
}
78+
79+
$version
80+
}
81+
82+
# All 3rd party packages for which symbols packages are expected should be listed here.
83+
# These must all be sourced from nuget.org, as it is the only feed that supports symbol packages.
84+
$3rdPartyPackageIds = @()
85+
86+
$3rdPartyPackageIds | % {
87+
$version = Get-PackageVersion $_
88+
if ($version) {
89+
Get-SymbolsFromPackage -id $_ -version $version
90+
}
91+
}

tools/Get-SymbolFiles.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ $PDBs |% {
4343
}
4444
} |% {
4545
# Collect the DLLs/EXEs as well.
46-
$rootName = "$($_.Directory)/$($_.BaseName)"
46+
$rootName = Join-Path $_.Directory $_.BaseName
4747
if ($rootName.EndsWith('.ni')) {
4848
$rootName = $rootName.Substring(0, $rootName.Length - 3)
4949
}

tools/Install-DotNetSdk.ps1

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ if (!(Test-Path $DotNetInstallScriptRoot)) { New-Item -ItemType Directory -Path
3636
$DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot
3737

3838
# Look up actual required .NET SDK version from global.json
39-
$sdkVersion = & "$PSScriptRoot/variables/DotNetSdkVersion.ps1"
39+
$sdks = @(New-Object PSObject -Property @{ Version = & "$PSScriptRoot/variables/DotNetSdkVersion.ps1" })
40+
41+
# Sometimes a repo requires extra SDKs to be installed (e.g. msbuild.locator scenarios running in tests).
42+
# In such a circumstance, a precise SDK version or a channel can be added as in the example below:
43+
# $sdks += New-Object PSObject -Property @{ Channel = '8.0' }
4044

4145
If ($IncludeX86 -and ($IsMacOS -or $IsLinux)) {
4246
Write-Verbose "Ignoring -IncludeX86 switch because 32-bit runtimes are only supported on Windows."
@@ -191,13 +195,16 @@ if ($InstallLocality -eq 'machine') {
191195
$DotNetInstallDir = '/usr/share/dotnet'
192196
} else {
193197
$restartRequired = $false
194-
if ($PSCmdlet.ShouldProcess(".NET SDK $sdkVersion", "Install")) {
195-
Install-DotNet -Version $sdkVersion -Architecture $arch
196-
$restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
197-
198-
if ($IncludeX86) {
199-
Install-DotNet -Version $sdkVersion -Architecture x86
198+
$sdks |% {
199+
if ($_.Version) { $version = $_.Version } else { $version = $_.Channel }
200+
if ($PSCmdlet.ShouldProcess(".NET SDK $_", "Install")) {
201+
Install-DotNet -Version $version -Architecture $arch
200202
$restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
203+
204+
if ($IncludeX86) {
205+
Install-DotNet -Version $version -Architecture x86
206+
$restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
207+
}
201208
}
202209
}
203210

@@ -296,29 +303,33 @@ $DotNetInstallScriptPathExpression = "& '$DotNetInstallScriptPathExpression'"
296303
$anythingInstalled = $false
297304
$global:LASTEXITCODE = 0
298305

299-
if ($PSCmdlet.ShouldProcess(".NET SDK $sdkVersion", "Install")) {
300-
$anythingInstalled = $true
301-
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture $arch -InstallDir $DotNetInstallDir $switches"
306+
$sdks |% {
307+
if ($_.Version) { $parameters = '-Version', $_.Version } else { $parameters = '-Channel', $_.Channel }
302308

303-
if ($LASTEXITCODE -ne 0) {
304-
Write-Error ".NET SDK installation failure: $LASTEXITCODE"
305-
exit $LASTEXITCODE
306-
}
307-
} else {
308-
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture $arch -InstallDir $DotNetInstallDir $switches -DryRun"
309-
}
310-
311-
if ($IncludeX86) {
312-
if ($PSCmdlet.ShouldProcess(".NET x86 SDK $sdkVersion", "Install")) {
309+
if ($PSCmdlet.ShouldProcess(".NET SDK $_", "Install")) {
313310
$anythingInstalled = $true
314-
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture x86 -InstallDir $DotNetX86InstallDir $switches"
311+
Invoke-Expression -Command "$DotNetInstallScriptPathExpression $parameters -Architecture $arch -InstallDir $DotNetInstallDir $switches"
315312

316313
if ($LASTEXITCODE -ne 0) {
317-
Write-Error ".NET x86 SDK installation failure: $LASTEXITCODE"
314+
Write-Error ".NET SDK installation failure: $LASTEXITCODE"
318315
exit $LASTEXITCODE
319316
}
320317
} else {
321-
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture x86 -InstallDir $DotNetX86InstallDir $switches -DryRun"
318+
Invoke-Expression -Command "$DotNetInstallScriptPathExpression $parameters -Architecture $arch -InstallDir $DotNetInstallDir $switches -DryRun"
319+
}
320+
321+
if ($IncludeX86) {
322+
if ($PSCmdlet.ShouldProcess(".NET x86 SDK $_", "Install")) {
323+
$anythingInstalled = $true
324+
Invoke-Expression -Command "$DotNetInstallScriptPathExpression $parameters -Architecture x86 -InstallDir $DotNetX86InstallDir $switches"
325+
326+
if ($LASTEXITCODE -ne 0) {
327+
Write-Error ".NET x86 SDK installation failure: $LASTEXITCODE"
328+
exit $LASTEXITCODE
329+
}
330+
} else {
331+
Invoke-Expression -Command "$DotNetInstallScriptPathExpression $parameters -Architecture x86 -InstallDir $DotNetX86InstallDir $switches -DryRun"
332+
}
322333
}
323334
}
324335

0 commit comments

Comments
 (0)