Skip to content

Commit

Permalink
Merge pull request #1039 from dotnet/libtemplateUpdate
Browse files Browse the repository at this point in the history
Merge latest Library.Template
  • Loading branch information
AArnott authored May 17, 2024
2 parents 82b9858 + aeef985 commit 541620f
Show file tree
Hide file tree
Showing 23 changed files with 68 additions and 37 deletions.
10 changes: 2 additions & 8 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@
"isRoot": true,
"tools": {
"powershell": {
"version": "7.3.9",
"version": "7.4.2",
"commands": [
"pwsh"
]
},
"dotnet-format": {
"version": "5.1.250801",
"commands": [
"dotnet-format"
]
},
"dotnet-coverage": {
"version": "17.9.3",
"version": "17.11.0",
"commands": [
"dotnet-coverage"
]
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions
FROM mcr.microsoft.com/dotnet/sdk:8.0.100-jammy
FROM mcr.microsoft.com/dotnet/sdk:8.0.201-jammy

# Installing mono makes `dotnet test` work without errors even for net472.
# But installing it takes a long time, so it's excluded by default.
Expand Down
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ indent_size = 4
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_property = true:warning
dotnet_style_qualification_for_method = true:warning
Expand Down
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ updates:
directory: /
schedule:
interval: monthly
ignore:
# This package has unlisted versions on nuget.org that are not supported. Avoid them.
- dependency-name: dotnet-format
versions: ["6.x", "7.x", "8.x", "9.x"]
- package-ecosystem: npm
directory: /src/nerdbank-gitversioning.npm
schedule:
Expand Down
Empty file added .prettierrc.yaml
Empty file.
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"k--kato.docomment",
"editorconfig.editorconfig",
"formulahendry.dotnet-test-explorer",
"esbenp.prettier-vscode",
"pflannery.vscode-versionlens",
"davidanson.vscode-markdownlint",
"dotjoshjohnson.xml",
Expand Down
17 changes: 16 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,20 @@
"files.trimFinalNewlines": true,
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableRoslynAnalyzers": true,
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true,
"editor.formatOnSave": true,
"[xml]": {
"editor.wordWrap": "off"
},
// Treat these files as Azure Pipelines files
"files.associations": {
"**/azure-pipelines/**/*.yml": "azure-pipelines",
"azure-pipelines.yml": "azure-pipelines"
},
// Use Prettier as the default formatter for Azure Pipelines files.
// Needs to be explicitly configured: https://github.com/Microsoft/azure-pipelines-vscode#document-formatting
"[azure-pipelines]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false // enable this when they conform
},
}
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<!-- Workaround https://github.com/dotnet/wpf/issues/1718 -->
Expand Down
11 changes: 6 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- https://learn.microsoft.com/nuget/consume-packages/central-package-management -->
<PropertyGroup>
Expand All @@ -23,7 +24,7 @@
<PackageVersion Include="Microsoft.Build" Version="$(MSBuildPackageVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" />
<PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.206-beta" />
<PackageVersion Include="Nerdbank.GitVersioning.LKG" Version="3.4.173-alpha" />
<PackageVersion Include="Newtonsoft.Json.Schema" Version="3.0.15" />
Expand All @@ -37,17 +38,17 @@
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="8.0.0" />
<PackageVersion Include="Validation" Version="2.5.51" />
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.0" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageVersion Include="xunit" Version="2.6.1" />
<PackageVersion Include="xunit" Version="2.8.0" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.495" />
<GlobalPackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
<GlobalPackageReference Include="Nullable" Version="1.3.1" />
<GlobalPackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.507" />
<GlobalPackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ stages:
clean: true
submodules: true # keep the warnings quiet about the wiki not being enlisted
- task: UseDotNet@2
displayName: Install .NET 8.0.100 SDK
displayName: Install .NET 8.0.201 SDK
inputs:
packageType: sdk
version: 8.0.100
version: 8.0.201
- script: dotnet --info
displayName: Show dotnet SDK info
- bash: |
Expand Down
5 changes: 3 additions & 2 deletions azure-pipelines/artifacts/_pipelines.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
[CmdletBinding()]
param (
[string]$ArtifactNameSuffix,
[switch]$StageOnly
[switch]$StageOnly,
[switch]$AvoidSymbolicLinks
)

Function Set-PipelineVariable($name, $value) {
Expand All @@ -24,7 +25,7 @@ Function Test-ArtifactUploaded($artifactName) {
Test-Path "env:$varName"
}

& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% {
& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix -AvoidSymbolicLinks:$AvoidSymbolicLinks |% {
# Set a variable which will out-live this script so that a subsequent attempt to collect and upload artifacts
# will skip this one from a check in the _all.ps1 script.
Set-PipelineVariable "ARTIFACTSTAGED_$($_.Name.ToUpper())" 'true'
Expand Down
16 changes: 14 additions & 2 deletions azure-pipelines/artifacts/_stage_all.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

[CmdletBinding()]
param (
[string]$ArtifactNameSuffix
[string]$ArtifactNameSuffix,
[switch]$AvoidSymbolicLinks
)

$ArtifactStagingFolder = & "$PSScriptRoot/../Get-ArtifactsStagingDirectory.ps1" -CleanIfLocal
Expand All @@ -30,6 +31,12 @@ function Create-SymbolicLink {
} else {
cmd /c "mklink `"$Link`" `"$Target`"" | Out-Null
}

if ($LASTEXITCODE -ne 0) {
# Windows requires admin privileges to create symbolic links
# unless Developer Mode has been enabled.
throw "Failed to create symbolic link at $Link that points to $Target"
}
}

# Stage all artifacts
Expand All @@ -42,7 +49,12 @@ $Artifacts |% {

if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null }
if (Test-Path -PathType Leaf $_.Source) { # skip folders
Create-SymbolicLink -Link (Join-Path $DestinationFolder $Name) -Target $_.Source
$TargetPath = Join-Path $DestinationFolder $Name
if ($AvoidSymbolicLinks) {
Copy-Item -Path $_.Source -Destination $TargetPath
} else {
Create-SymbolicLink -Link $TargetPath -Target $_.Source
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- template: install-dependencies.yml
- pwsh: |
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
& .\dotnet-install.ps1 -Architecture x86 -Version 8.0.100 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose
& .\dotnet-install.ps1 -Architecture x86 -Version 8.0.201 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose
displayName: ⚙ Install 32-bit .NET SDK and runtimes
- template: dotnet.yml
Expand All @@ -44,6 +44,8 @@ jobs:
- template: dotnet.yml
parameters:
RunTests: ${{ parameters.RunTests }}
- script: dotnet format --verify-no-changes --no-restore
displayName: 💅 Verify formatted code

- job: WrapUp
dependsOn:
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "8.0.201",
"rollForward": "patch",
"allowPrerelease": false
}
Expand Down
11 changes: 5 additions & 6 deletions init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ try {
$HeaderColor = 'Green'

$RestoreArguments = @()
if ($Interactive)
{
if ($Interactive) {
$RestoreArguments += '--interactive'
}

Expand All @@ -98,10 +97,10 @@ try {
}

if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) {
dotnet tool restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring dotnet CLI tools."
}
dotnet tool restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring dotnet CLI tools."
}
}

if (!$NoRestore -and $PSCmdlet.ShouldProcess("NPM packages", "Restore")) {
Expand Down
3 changes: 3 additions & 0 deletions settings.VisualStudio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"textEditor.codeCleanup.profile": "profile1"
}
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- Include and reference README in nuget package, if a README is in the project directory. -->
<PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)AssemblyInfo.cs" />
Expand Down
1 change: 1 addition & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..))" />

Expand Down
1 change: 1 addition & 0 deletions test/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..))" />
</Project>
6 changes: 3 additions & 3 deletions test/Nerdbank.GitVersioning.Tests/BuildIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ protected void AssertStandardProperties(VersionOptions versionOptions, BuildResu
Version version = this.GetVersion(relativeProjectDirectory);
Version assemblyVersion = GetExpectedAssemblyVersion(versionOptions, version);
IEnumerable<string> additionalBuildMetadata = from item in buildResult.BuildResult.ProjectStateAfterBuild.GetItems("BuildMetadata")
select item.EvaluatedInclude;
select item.EvaluatedInclude;
string expectedBuildMetadata = $"+{commitIdShort}";
if (additionalBuildMetadata.Any())
{
Expand Down Expand Up @@ -430,8 +430,8 @@ private void LoadTargetsIntoProjectCollection()
string prefix = $"{ThisAssembly.RootNamespace}.Targets.";

IEnumerable<string> streamNames = from name in Assembly.GetExecutingAssembly().GetManifestResourceNames()
where name.StartsWith(prefix, StringComparison.Ordinal)
select name;
where name.StartsWith(prefix, StringComparison.Ordinal)
select name;
foreach (string name in streamNames)
{
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name))
Expand Down
2 changes: 1 addition & 1 deletion test/Nerdbank.GitVersioning.Tests/MSBuildExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal static void LoadMSBuild()
if (IntPtr.Size == 4)
{
// 32-bit .NET runtime requires special code to find the x86 SDK (where MSBuild is).
MSBuildLocator.RegisterMSBuildPath(@"C:\Program Files (x86)\dotnet\sdk\8.0.100");
MSBuildLocator.RegisterMSBuildPath(@"C:\Program Files (x86)\dotnet\sdk\8.0.201");
}
else
{
Expand Down

0 comments on commit 541620f

Please sign in to comment.