Skip to content

Commit 8200333

Browse files
Merge pull request #133 from microsoft/library.template/2025-09-25
Library.template/2025 09 25
2 parents a5c8b17 + eea6ae5 commit 8200333

36 files changed

Lines changed: 353 additions & 136 deletions

.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.3",
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.305-noble@sha256:604ef064c6d91068eeb9d946036d8ffadbe25589c4cd77a230fc96e0f6d01d72
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.

.github/copilot-instructions.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copilot instructions for this repository
2+
3+
## High level guidance
4+
5+
* Review the `CONTRIBUTING.md` file for instructions to build and test the software.
6+
* Set the `NBGV_GitEngine` environment variable to `Disabled` before running any `dotnet` or `msbuild` commands.
7+
8+
## Software Design
9+
10+
* Design APIs to be highly testable, and all functionality should be tested.
11+
* Avoid introducing binary breaking changes in public APIs of projects under `src` unless their project files have `IsPackable` set to `false`.
12+
13+
## Testing
14+
15+
* There should generally be one test project (under the `test` directory) per shipping project (under the `src` directory). Test projects are named after the project being tested with a `.Test` suffix.
16+
* Tests should use the Xunit testing framework.
17+
* Some tests are known to be unstable. When running tests, you should skip the unstable ones by running `dotnet test --filter "TestCategory!=FailsInCloudTest"`.
18+
19+
## Coding style
20+
21+
* Honor StyleCop rules and fix any reported build warnings *after* getting tests to pass.
22+
* In C# files, use namespace *statements* instead of namespace *blocks* for all new files.
23+
* Add API doc comments to all new public and internal members.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 💪🏼 Copilot Setup Steps
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- .github/workflows/copilot-setup-steps.yml
12+
pull_request:
13+
paths:
14+
- .github/workflows/copilot-setup-steps.yml
15+
16+
jobs:
17+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
18+
copilot-setup-steps:
19+
runs-on: ubuntu-latest
20+
# Set the permissions to the lowest permissions possible needed for your steps.
21+
# Copilot will be given its own token for its operations.
22+
permissions:
23+
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
24+
contents: read
25+
26+
# You can define any steps you want, and they will run before the agent starts.
27+
# If you do not check out your code, Copilot will do this for you.
28+
steps:
29+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
30+
with:
31+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
32+
- name: ⚙ Install prerequisites
33+
run: |
34+
./init.ps1 -UpgradePrerequisites -NoNuGetCredProvider
35+
dotnet --info
36+
37+
# Print mono version if it is present.
38+
if (Get-Command mono -ErrorAction SilentlyContinue) {
39+
mono --version
40+
}
41+
shell: pwsh

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33
##
4-
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
4+
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
55

66
# User-specific files
77
*.rsuser

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ This repository can be built on Windows, Linux, and OSX.
4545

4646
Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.).
4747

48-
[pwsh]: https://docs.microsoft.com/powershell/scripting/install/installing-powershell?view=powershell-6
48+
[pwsh]: https://learn.microsoft.com/powershell/scripting/install/installing-powershell
4949

5050
## Releases
5151

@@ -59,9 +59,9 @@ Push the tag.
5959
When your repo is hosted by GitHub and you are using GitHub Actions, you should create a GitHub Release using the standard GitHub UI.
6060
Having previously used `nbgv tag` and pushing the tag will help you identify the precise commit and name to use for this release.
6161

62-
After publishing the release, the `.github\workflows\release.yml` workflow will be automatically triggered, which will:
62+
After publishing the release, the `.github/workflows/release.yml` workflow will be automatically triggered, which will:
6363

64-
1. Find the most recent `.github\workflows\build.yml` GitHub workflow run of the tagged release.
64+
1. Find the most recent `.github/workflows/build.yml` GitHub workflow run of the tagged release.
6565
1. Upload the `deployables` artifact from that workflow run to your GitHub Release.
6666
1. If you have `NUGET_API_KEY` defined as a secret variable for your repo or org, any nuget packages in the `deployables` artifact will be pushed to nuget.org.
6767

@@ -72,7 +72,7 @@ Trigger the pipeline by adding the `auto-release` tag on a run of your main `azu
7272

7373
## Tutorial and API documentation
7474

75-
API and hand-written docs are found under the `docfx/` directory. and are built by [docfx](https://dotnet.github.io/docfx/).
75+
API and hand-written docs are found under the `docfx/` directory and are built by [docfx](https://dotnet.github.io/docfx/).
7676

7777
You can make changes and host the site locally to preview them by switching to that directory and running the `dotnet docfx --serve` command.
7878
After making a change, you can rebuild the docs site while the localhost server is running by running `dotnet docfx` again from a separate terminal.
@@ -94,11 +94,11 @@ If Renovate is not creating pull requests when you expect it to, check that the
9494
### Maintaining your repo based on this template
9595

9696
The best way to keep your repo in sync with Library.Template's evolving features and best practices is to periodically merge the template into your repo:
97-
`
97+
9898
```ps1
9999
git fetch
100100
git checkout origin/main
101-
.\tools\MergeFrom-Template.ps1
101+
./tools/MergeFrom-Template.ps1
102102
# resolve any conflicts, then commit the merge commit.
103103
git push origin -u HEAD
104104
```

CodeQL.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
path_classifiers:
2+
library:
3+
- 'test/**'

Directory.Build.props

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
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+
<VSIXOutputPath Condition="'$(Platform)'=='' or '$(Platform)'=='AnyCPU'">$(RepoRootPath)bin\Packages\$(Configuration)\Vsix\</VSIXOutputPath>
11+
<SBOMFileDestPath>$(VSIXOutputPath)</SBOMFileDestPath>
1012
<Nullable>enable</Nullable>
1113
<!-- Don't use generated implicit usings so we can default to Microsoft.IO in net472. -->
1214
<ImplicitUsings>disable</ImplicitUsings>
@@ -15,12 +17,14 @@
1517
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1618
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
1719

20+
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/apicompat/package-validation/overview -->
21+
<EnablePackageValidation>true</EnablePackageValidation>
22+
1823
<!-- https://github.com/dotnet/msbuild/blob/main/documentation/ProjectReference-Protocol.md#setplatform-negotiation -->
1924
<EnableDynamicPlatformResolution>true</EnableDynamicPlatformResolution>
2025

2126
<!-- Opt in till https://github.com/NuGet/Home/issues/9803 makes this the default. -->
22-
<!-- Opt back out until an SDK with the fix for https://github.com/NuGet/Home/issues/12177 is generally available. -->
23-
<RestoreUseStaticGraphEvaluation>false</RestoreUseStaticGraphEvaluation>
27+
<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>
2428

2529
<!-- This entire repo has just one version.json file, so compute the version once and share with all projects in a large build. -->
2630
<GitVersionBaseDirectory>$(MSBuildThisFileDirectory)</GitVersionBaseDirectory>
@@ -62,4 +66,6 @@
6266
<PackageReleaseNotes Condition="'$(RepositoryUrl)'!=''">$(RepositoryUrl)/releases/tag/v$(Version)</PackageReleaseNotes>
6367
</PropertyGroup>
6468
</Target>
69+
70+
<Import Project="azure-pipelines\NuGetSbom.props" />
6571
</Project>

Directory.Build.targets

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44
<!-- Avoid compile error about missing namespace when combining ImplicitUsings with .NET Framework target frameworks. -->
55
<Using Remove="System.Net.Http" Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'" />
66
</ItemGroup>
7-
8-
<Import Project="azure-pipelines\NuGetSbom.targets" Condition="'$(IsPackable)'!='false'" />
97
</Project>

Directory.Packages.props

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
66
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
77

8-
<MicroBuildVersion>2.0.187</MicroBuildVersion>
8+
<MicroBuildVersion>2.0.201</MicroBuildVersion>
99
</PropertyGroup>
1010
<ItemGroup>
1111
<!-- Put repo-specific PackageVersion items in this group. -->
@@ -16,10 +16,10 @@
1616
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
1717
</ItemGroup>
1818
<ItemGroup Label="Library.Template">
19-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
19+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
2020
<PackageVersion Include="Microsoft.VisualStudio.Internal.MicroBuild.NonShipping" Version="$(MicroBuildVersion)" />
21-
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
22-
<PackageVersion Include="xunit.v3" Version="2.0.1" />
21+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.4" />
22+
<PackageVersion Include="xunit.v3" Version="3.0.1" />
2323
</ItemGroup>
2424
<ItemGroup>
2525
<!-- Put repo-specific GlobalPackageReference items in this group. -->
@@ -29,7 +29,8 @@
2929
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.593" />
3030
<GlobalPackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
3131
<GlobalPackageReference Include="Microsoft.VisualStudio.Internal.MicroBuild.VisualStudio" Version="$(MicroBuildVersion)" />
32-
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" />
32+
<!-- The condition works around https://github.com/dotnet/sdk/issues/44951 -->
33+
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" Condition="!('$(TF_BUILD)'=='true' and '$(dotnetformat)'=='true')" />
3334
<GlobalPackageReference Include="PolySharp" Version="1.15.0" />
3435
<GlobalPackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" />
3536
</ItemGroup>

0 commit comments

Comments
 (0)