diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..3a8aeea --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build + +on: + push: + branches: '**' + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + Build: + # net35/net48 and WPF test projects plus the msbuild.exe engine need Windows with Visual Studio. + runs-on: windows-2025-vs2026 + env: + Configuration: Release + # The in-repo isolated test cache exceeds MAX_PATH under msbuild.exe on the runner's deep checkout path. + # One run only ever sees one annotator version, so a shared short-path cache is safe here. + TestPackages: ${{ github.workspace }}\..\p + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 # Nerdbank.GitVersioning needs the history + persist-credentials: false + + - uses: actions/setup-dotnet@v5 + with: + dotnet-version: '11.0.x' + dotnet-quality: 'preview' + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v3 + + - name: Build and pack + run: dotnet build ReferenceAssemblyAnnotator.sln -c $env:Configuration + + - name: Test (dotnet msbuild) + run: ./build/test.ps1 -Configuration $env:Configuration -Engine dotnet -PackagesPath $env:TestPackages + + - name: Test (msbuild.exe) + run: ./build/test.ps1 -Configuration $env:Configuration -Engine msbuild -PackagesPath $env:TestPackages + + - name: Upload NuGet package + uses: actions/upload-artifact@v7 + with: + name: nuget-package + path: ICSharpCode.ReferenceAssemblyAnnotator/bin/${{ env.Configuration }}/*.nupkg + if-no-files-found: error diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..27b842b --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,57 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## What this is + +An IL weaver shipped as a NuGet package (`ICSharpCode.ReferenceAssemblyAnnotator`, the continuation of `TunnelVisionLabs.ReferenceAssemblyAnnotator`). At build time in a consuming project it takes un-annotated reference assemblies (.NET Framework, .NET Standard, .NET Core < 3.0; .NET Core 3.0+ is skipped because it is already annotated) and copies nullability attributes onto them from the annotated `Microsoft.NETCore.App.Ref` package the consumer pulls via ``. The project then compiles against the annotated copies. + +## Build + +`global.json` selects the newest installed SDK 11 (prerelease allowed). Windows is required for the full test matrix (net35/net48, WPF, msbuild.exe). + +``` +dotnet build ReferenceAssemblyAnnotator.sln -c Release +``` + +- `GeneratePackageOnBuild` is on: the build writes the `.nupkg` to `ICSharpCode.ReferenceAssemblyAnnotator/bin//`. The version comes from Nerdbank.GitVersioning (`version.json`), so it only reflects committed changes. +- `TreatWarningsAsErrors` is on outside Visual Studio; StyleCop.Analyzers (`stylecop.json`) and `ICSharpCode.ReferenceAssemblyAnnotator.ruleset` apply. Assemblies are strong-name signed (`build/Key.snk`). +- The repo annotates its own references with the *published* `TunnelVisionLabs.ReferenceAssemblyAnnotator` (see `Directory.Build.props`), not the local build. That old version still has the `GetElementType()` comparer bug fixed here. It only works because this repo's own TFMs never hit the bug, so switch to the published `ICSharpCode.*` package once it exists. +- The task targets netstandard2.0 (dotnet MSBuild) and net472 (VS MSBuild) and compiles against MSBuild 17.8 (compile-only). Don't raise that to MSBuild 18: it drags in System.Collections.Immutable 10, which older hosts can't load. + +## Tests + +There is no unit test project. The tests are sample projects under `tests/` that must build cleanly with warnings as errors against the locally built package. Build the solution first, then: + +``` +./build/test.ps1 -Configuration Release -Engine dotnet # dotnet msbuild +./build/test.ps1 -Configuration Release -Engine msbuild # VS msbuild.exe (found via vswhere) +``` + +The script sets `NUGET_PACKAGES` to the isolated cache `tests/.isolatednugetcache` (an inherited machine-wide `NUGET_PACKAGES` would override `globalPackagesFolder` and serve a stale package with the same version), runs `git clean -dxf tests` before every case, and sets `CONFIGURATION` for the local source in `tests/NuGet.Config`. Source mapping forces `ICSharpCode.ReferenceAssemblyAnnotator` to come from `ICSharpCode.ReferenceAssemblyAnnotator/bin/`. To run a single case by hand: + +``` +$env:CONFIGURATION='Release'; $env:NUGET_PACKAGES="$PWD\tests\.isolatednugetcache"; git clean -dxf tests +dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netstandard2.0 -warnaserror -nr:false -v:m +``` + +- `tests/SingleTFM` is parameterized by `-p:TestFramework=` (net35 … net10.0); MultiTFM, RefVersion3.1.0, NoDisabledWarnings (uses `-p:TreatWarningsAsErrors=true`, since `-warnaserror` ignores `WarningsNotAsErrors`) and WPF cover the rest. +- The test projects leave out the `Microsoft.NETCore.App.Ref` `PackageDownload` for .NET Core 3.0+ (netcoreapp3.x, net10.0). Those aren't annotated, and the SDK adds its own download whenever the targeting pack isn't installed, so a second one fails with NU1505. The `GetHashCode` line in the test sources is `#if !NETCOREAPP3_0_OR_GREATER` because only annotated TFMs get `[DisallowNull]` removed (`Program.IsExcludedAnnotation`). +- Keep the local source path in `tests/NuGet.Config` with forward slashes: with backslashes, source mapping doesn't match it on Linux/macOS (NU1100). + +CI: `.github/workflows/build.yml` runs the same build and test script with both engines (Release only) and uploads the nupkg. On the runner, paths in the isolated cache exceed MAX_PATH under `msbuild.exe`. So the workflow passes `-PackagesPath` with a short path outside the checkout; that cache isn't wiped between cases, which is safe because a run only ever contains one annotator version. `test.ps1` also passes `core.longpaths=true` to `git clean`. + +## Architecture + +**MSBuild integration (most of the logic lives here)**: `ICSharpCode.ReferenceAssemblyAnnotator.props`/`.targets`, packed into `build/`. The file names must match the package ID. +- `.props` picks the task DLL: `tools/net472/` for full MSBuild, `tools/netstandard2.0/` for `dotnet` (Core) MSBuild. The Mono.Cecil DLLs are packed next to it via `_GetFilesToPackage`. +- `.targets` hooks `ResolveAssemblyReferencesDependsOn` with `AnnotateReferenceAssemblies` → `UpdateReferences`, except for .NETCoreApp >= 3.0. It resolves the annotated source directory from the `Microsoft.NETCore.App.Ref` `PackageDownload` (errors RA0000–RA0002) and decides which references to annotate per target framework family: a hard-coded list for .NETFramework, framework-package references for .NETStandard/.NETCoreApp, and `ResolvedCompileFileDefinitionsToAdd` below 2.0. It writes the outputs to `$(IntermediateOutputPath)annotated\`, then swaps the `Reference` items and prepends that folder to `TargetFrameworkDirectory`. +- It also adds `NullableAttributes.cs`/`.vb` (internal copies of the nullable attributes) as `Compile` items unless the TFM already has them or `GenerateNullableAttributes=false`. The WPF `_GeneratedCodeFiles` line works around dotnet/wpf#810. + +**Weaver (C#)** in `ICSharpCode.ReferenceAssemblyAnnotator/`: +- `AnnotatorBuildTask`: the MSBuild task, invoked once per unannotated assembly; it calls `Program.Main`. +- `Program`: loads both assemblies with Mono.Cecil, walks types, methods, properties and fields, finds the matching member in the annotated assembly, and copies the nullability-related custom attributes. The `EquivalenceComparers+*` classes compare signatures structurally across different assembly identities; note that Cecil's `GetElementType()` returns the *innermost* type, so compare `TypeSpecification.ElementType` instead. It also makes sure the output carries `ReferenceAssemblyAttribute`. +- `WellKnownTypes` + `WellKnownTypes+*ProvidedType`: when the target assembly doesn't define an attribute type, it is synthesized into the output assembly as an internal embedded type via `CustomAttributeFactory`/`MethodFactory`. +- `SuppressibleLoggingHelper`: RA1xxx warnings that honor the consumer's `NoWarn`, which is passed in as `DisabledWarnings`. + +**`CecilBasedAnnotator`**: a small net472 console wrapper around `Program.Main` for debugging the weaver outside MSBuild. Arguments: ` `; sample profiles are in `Properties/launchSettings.json`. diff --git a/CecilBasedAnnotator/CecilBasedAnnotator.csproj b/CecilBasedAnnotator/CecilBasedAnnotator.csproj index cdc8e72..0848c0f 100644 --- a/CecilBasedAnnotator/CecilBasedAnnotator.csproj +++ b/CecilBasedAnnotator/CecilBasedAnnotator.csproj @@ -6,11 +6,11 @@ - ..\TunnelVisionLabs.ReferenceAssemblyAnnotator.ruleset + ..\ICSharpCode.ReferenceAssemblyAnnotator.ruleset - + diff --git a/CecilBasedAnnotator/Program.cs b/CecilBasedAnnotator/Program.cs index a4d924c..da36650 100644 --- a/CecilBasedAnnotator/Program.cs +++ b/CecilBasedAnnotator/Program.cs @@ -9,7 +9,7 @@ internal class Program { private static void Main(string[] args) { - TunnelVisionLabs.ReferenceAssemblyAnnotator.Program.Main( + ICSharpCode.ReferenceAssemblyAnnotator.Program.Main( log: null, referenceAssembly: args[0], targetFrameworkDirectories: args[1].Split(';').ToImmutableArray(), diff --git a/CecilBasedAnnotator/Properties/launchSettings.json b/CecilBasedAnnotator/Properties/launchSettings.json index fce9750..fc7ef20 100644 --- a/CecilBasedAnnotator/Properties/launchSettings.json +++ b/CecilBasedAnnotator/Properties/launchSettings.json @@ -2,11 +2,11 @@ "profiles": { "Microsoft.Win32.Primitives (netstandard1.6)": { "commandName": "Project", - "commandLineArgs": "\"$(NuGetPackageRoot)\\microsoft.win32.primitives\\4.3.0\\ref\\netstandard1.3\\Microsoft.Win32.Primitives.dll\" \"$(NuGetPackageRoot)\\microsoft.win32.primitives\\4.3.0\\ref\\netstandard1.3\\;$(NuGetPackageRoot)\\system.runtime\\4.3.0\\ref\\netstandard1.5\\\\\" \"$(NuGetPackageRoot)\\microsoft.netcore.app.ref\\3.0.0\\ref\\netcoreapp3.0\\Microsoft.Win32.Primitives.dll\" Microsoft.Win32.Primitives.dll" + "commandLineArgs": "\"$(NuGetPackageRoot)\\microsoft.win32.primitives\\4.3.0\\ref\\netstandard1.3\\Microsoft.Win32.Primitives.dll\" \"$(NuGetPackageRoot)\\microsoft.win32.primitives\\4.3.0\\ref\\netstandard1.3\\;$(NuGetPackageRoot)\\system.runtime\\4.3.0\\ref\\netstandard1.5\\\\\" \"$(NuGetPackageRoot)\\microsoft.netcore.app.ref\\10.0.0\\ref\\net10.0\\Microsoft.Win32.Primitives.dll\" Microsoft.Win32.Primitives.dll" }, "System.ComponentModel.DataAnnotations (netcoreapp2.0)": { "commandName": "Project", - "commandLineArgs": "\"$(NuGetPackageRoot)\\microsoft.netcore.app\\2.0.0\\ref\\netcoreapp2.0\\System.ComponentModel.DataAnnotations.dll\" \"$(NuGetPackageRoot)\\microsoft.netcore.app\\2.0.0\\ref\\netcoreapp2.0\\\\\" \"$(NuGetPackageRoot)\\microsoft.netcore.app.ref\\3.0.0\\ref\\netcoreapp3.0\\System.ComponentModel.DataAnnotations.dll\" System.ComponentModel.DataAnnotations.dll" + "commandLineArgs": "\"$(NuGetPackageRoot)\\microsoft.netcore.app\\2.0.0\\ref\\netcoreapp2.0\\System.ComponentModel.DataAnnotations.dll\" \"$(NuGetPackageRoot)\\microsoft.netcore.app\\2.0.0\\ref\\netcoreapp2.0\\\\\" \"$(NuGetPackageRoot)\\microsoft.netcore.app.ref\\10.0.0\\ref\\net10.0\\System.ComponentModel.DataAnnotations.dll\" System.ComponentModel.DataAnnotations.dll" } } } \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 6eaa386..0f26d75 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -29,26 +29,21 @@ $(MSBuildThisFileDirectory)build\Key.snk - - - - - enable - 3.1.0 + 10.0.0 false - + - + @@ -59,23 +54,27 @@ - + IL weaver for adding nullability annotations to .NET Framework and .NET Standard reference assemblies. - TunnelVisionLabs.ReferenceAssemblyAnnotator - Tunnel Vision Laboratories, LLC - Copyright © Tunnel Vision Laboratories, LLC 2019 + ICSharpCode.ReferenceAssemblyAnnotator + ic#code + Copyright © Tunnel Vision Laboratories, LLC 2019; Copyright © ic#code $([System.DateTime]::Now.Year) en-US - sharwell - https://github.com/tunnelvisionlabs/ReferenceAssemblyAnnotator + ILSpy Contributors + https://github.com/icsharpcode/ReferenceAssemblyAnnotator MIT - https://github.com/tunnelvisionlabs/ReferenceAssemblyAnnotator + README.md + nullable;nullability;reference-assemblies;msbuild;il-weaver + https://github.com/icsharpcode/ReferenceAssemblyAnnotator.git git + true - true - true + + embedded + true + ..\tools\net472\ ..\tools\netstandard2.0\ diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/TunnelVisionLabs.ReferenceAssemblyAnnotator.targets b/ICSharpCode.ReferenceAssemblyAnnotator/ICSharpCode.ReferenceAssemblyAnnotator.targets similarity index 95% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/TunnelVisionLabs.ReferenceAssemblyAnnotator.targets rename to ICSharpCode.ReferenceAssemblyAnnotator/ICSharpCode.ReferenceAssemblyAnnotator.targets index 10f60df..8c085f0 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/TunnelVisionLabs.ReferenceAssemblyAnnotator.targets +++ b/ICSharpCode.ReferenceAssemblyAnnotator/ICSharpCode.ReferenceAssemblyAnnotator.targets @@ -1,7 +1,7 @@  - + <_FrameworkIncludesNullableAttributes Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(TargetFrameworkVersion.Substring(1))' >= '3.0'">true @@ -23,7 +23,10 @@ - + + $(ResolveAssemblyReferencesDependsOn); AnnotateReferenceAssemblies; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/MethodFactory.cs b/ICSharpCode.ReferenceAssemblyAnnotator/MethodFactory.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/MethodFactory.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/MethodFactory.cs index abcd6a0..6c1c27e 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/MethodFactory.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/MethodFactory.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using Mono.Cecil; using Mono.Cecil.Cil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/NullableAttributes.cs b/ICSharpCode.ReferenceAssemblyAnnotator/NullableAttributes.cs similarity index 100% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/NullableAttributes.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/NullableAttributes.cs diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/NullableAttributes.vb b/ICSharpCode.ReferenceAssemblyAnnotator/NullableAttributes.vb similarity index 100% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/NullableAttributes.vb rename to ICSharpCode.ReferenceAssemblyAnnotator/NullableAttributes.vb diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/Program.cs b/ICSharpCode.ReferenceAssemblyAnnotator/Program.cs similarity index 97% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/Program.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/Program.cs index a79fc55..d44503a 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/Program.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/Program.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using System.Collections.Generic; @@ -287,7 +287,7 @@ private static bool IsExcludedAnnotation(ICustomAttributeProvider provider, ICus return annotatedTypeDefinition; } - private static MethodDefinition FindMatchingMethod(SuppressibleLoggingHelper? log, MethodDefinition methodDefinition, TypeDefinition annotatedTypeDefinition) + private static MethodDefinition? FindMatchingMethod(SuppressibleLoggingHelper? log, MethodDefinition methodDefinition, TypeDefinition annotatedTypeDefinition) { try { @@ -305,12 +305,12 @@ private static MethodDefinition FindMatchingMethod(SuppressibleLoggingHelper? lo } } - private static PropertyDefinition FindMatchingProperty(PropertyDefinition propertyDefinition, TypeDefinition annotatedTypeDefinition) + private static PropertyDefinition? FindMatchingProperty(PropertyDefinition propertyDefinition, TypeDefinition annotatedTypeDefinition) { return annotatedTypeDefinition.Properties.SingleOrDefault(property => EquivalenceComparers.PropertyDefinition.Equals(propertyDefinition, property)); } - private static FieldDefinition FindMatchingField(FieldDefinition fieldDefinition, TypeDefinition annotatedTypeDefinition) + private static FieldDefinition? FindMatchingField(FieldDefinition fieldDefinition, TypeDefinition annotatedTypeDefinition) { return annotatedTypeDefinition.Fields.SingleOrDefault(property => property.Name == fieldDefinition.Name); } diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/Properties/AssemblyInfo.cs b/ICSharpCode.ReferenceAssemblyAnnotator/Properties/AssemblyInfo.cs similarity index 100% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/Properties/AssemblyInfo.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/Properties/AssemblyInfo.cs diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/SuppressibleLoggingHelper.cs b/ICSharpCode.ReferenceAssemblyAnnotator/SuppressibleLoggingHelper.cs similarity index 97% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/SuppressibleLoggingHelper.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/SuppressibleLoggingHelper.cs index 0508f37..37f2930 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/SuppressibleLoggingHelper.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/SuppressibleLoggingHelper.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using System.Collections.Immutable; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/TypeDefinitionExtensions.cs b/ICSharpCode.ReferenceAssemblyAnnotator/TypeDefinitionExtensions.cs similarity index 91% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/TypeDefinitionExtensions.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/TypeDefinitionExtensions.cs index 47b5101..fbed44e 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/TypeDefinitionExtensions.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/TypeDefinitionExtensions.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+AllowNullAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+AllowNullAttributeProvidedType.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+AllowNullAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+AllowNullAttributeProvidedType.cs index 74ae356..2cbefbe 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+AllowNullAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+AllowNullAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DisallowNullAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DisallowNullAttributeProvidedType.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DisallowNullAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DisallowNullAttributeProvidedType.cs index c9798e1..6bdf5b2 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DisallowNullAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DisallowNullAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnAttributeProvidedType.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnAttributeProvidedType.cs index bc51b5e..137bc9a 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnIfAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnIfAttributeProvidedType.cs similarity index 95% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnIfAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnIfAttributeProvidedType.cs index 9c9296b..0080994 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnIfAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+DoesNotReturnIfAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+EmbeddedAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+EmbeddedAttributeProvidedType.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+EmbeddedAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+EmbeddedAttributeProvidedType.cs index 7d162bf..bb98df5 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+EmbeddedAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+EmbeddedAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System.Linq; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullAttributeProvidedType.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullAttributeProvidedType.cs index c4f1e82..8b116e3 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullWhenAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullWhenAttributeProvidedType.cs similarity index 95% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullWhenAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullWhenAttributeProvidedType.cs index 5cd62b3..65712a6 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullWhenAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+MaybeNullWhenAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullAttributeProvidedType.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullAttributeProvidedType.cs index f62438e..d126a3f 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullIfNotNullAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullIfNotNullAttributeProvidedType.cs similarity index 96% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullIfNotNullAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullIfNotNullAttributeProvidedType.cs index 99b091e..aa9bdc2 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullIfNotNullAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullIfNotNullAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullWhenAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullWhenAttributeProvidedType.cs similarity index 95% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullWhenAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullWhenAttributeProvidedType.cs index 1a73fca..fca54d6 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullWhenAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NotNullWhenAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullableAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullableAttributeProvidedType.cs similarity index 96% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullableAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullableAttributeProvidedType.cs index 5436896..58d6740 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullableAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullableAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System.Linq; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullableContextAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullableContextAttributeProvidedType.cs similarity index 95% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullableContextAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullableContextAttributeProvidedType.cs index 5bf5b78..a528078 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullableContextAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullableContextAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System.Linq; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullablePublicOnlyAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullablePublicOnlyAttributeProvidedType.cs similarity index 95% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullablePublicOnlyAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullablePublicOnlyAttributeProvidedType.cs index 0a47676..2c87ad0 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+NullablePublicOnlyAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+NullablePublicOnlyAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System.Linq; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+PredefinedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+PredefinedType.cs similarity index 92% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+PredefinedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+PredefinedType.cs index c266e8e..69d9588 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+PredefinedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+PredefinedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedAttributeType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedAttributeType.cs similarity index 96% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedAttributeType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedAttributeType.cs index 94b3d33..c842f2e 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedAttributeType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedAttributeType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedType.cs similarity index 96% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedType.cs index a66d4ea..b5365bd 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ReferenceAssemblyAttributeProvidedType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ReferenceAssemblyAttributeProvidedType.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ReferenceAssemblyAttributeProvidedType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ReferenceAssemblyAttributeProvidedType.cs index 25090a9..bea0577 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+ReferenceAssemblyAttributeProvidedType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+ReferenceAssemblyAttributeProvidedType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System.Linq; using System.Runtime.CompilerServices; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+WellKnownType.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+WellKnownType.cs similarity index 94% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+WellKnownType.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+WellKnownType.cs index 444511c..9d7c9db 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes+WellKnownType.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes+WellKnownType.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using Mono.Cecil; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes.cs similarity index 99% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes.cs index 58162e0..5993109 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WellKnownTypes.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WellKnownTypes.cs @@ -1,7 +1,7 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { using System; using System.Runtime.CompilerServices; diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WindowsErrorCode.cs b/ICSharpCode.ReferenceAssemblyAnnotator/WindowsErrorCode.cs similarity index 64% rename from TunnelVisionLabs.ReferenceAssemblyAnnotator/WindowsErrorCode.cs rename to ICSharpCode.ReferenceAssemblyAnnotator/WindowsErrorCode.cs index 64e8d7d..6995c1d 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WindowsErrorCode.cs +++ b/ICSharpCode.ReferenceAssemblyAnnotator/WindowsErrorCode.cs @@ -1,12 +1,12 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace TunnelVisionLabs.ReferenceAssemblyAnnotator +namespace ICSharpCode.ReferenceAssemblyAnnotator { internal enum WindowsErrorCode : ushort { /// - /// https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-#error_file_exists + /// See https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-#error_file_exists. /// FileExists = 80, } diff --git a/README.md b/README.md index bb9cae6..f60114e 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,15 @@ -# Reference Assembly Annotator +# Reference Assembly Annotator IL weaver for adding nullability annotations to .NET Framework, .NET Standard, and .NET Core reference assemblies. -[![Build status](https://ci.appveyor.com/api/projects/status/pikrerggo7mi7dy5/branch/master?svg=true)](https://ci.appveyor.com/project/sharwell/referenceassemblyannotator/branch/master) +[![Build](https://github.com/icsharpcode/ReferenceAssemblyAnnotator/actions/workflows/build.yml/badge.svg)](https://github.com/icsharpcode/ReferenceAssemblyAnnotator/actions/workflows/build.yml) -[![codecov](https://codecov.io/gh/tunnelvisionlabs/ReferenceAssemblyAnnotator/branch/master/graph/badge.svg)](https://codecov.io/gh/tunnelvisionlabs/ReferenceAssemblyAnnotator) - -[![Join the chat at https://gitter.im/tunnelvisionlabs/ReferenceAssemblyAnnotator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tunnelvisionlabs/ReferenceAssemblyAnnotator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +This is the continuation of [TunnelVisionLabs.ReferenceAssemblyAnnotator](https://github.com/tunnelvisionlabs/ReferenceAssemblyAnnotator), +published as `ICSharpCode.ReferenceAssemblyAnnotator`. To migrate, replace the package ID; the MSBuild properties and items are unchanged. ## Requirements -* Build: C# compiler version 3.2 Beta 2 or newer (ships with Visual Studio 2019 version 16.3 Preview 2 and newer). Older - versions of the compiler interpret nullable metadata differently, which can lead to incorrect build warnings. -* Editing experience: Visual Studio 2019 version 16.3 Preview 2 or newer. +* Build: .NET SDK 8 or newer, or Visual Studio 2022 version 17.8 or newer. ## Usage @@ -31,9 +28,18 @@ IL weaver for adding nullability annotations to .NET Framework, .NET Standard, a * System.Xml.Linq * .NET Standard targets * All assemblies which are defined by the .NET Standard -* .NET Core targets +* .NET Core targets before 3.0 * All reference assemblies defined by .NET Core +.NET Core 3.0 and newer are not annotated: their reference assemblies already carry nullable annotations. Don't add the +`Microsoft.NETCore.App.Ref` `PackageDownload` for those target frameworks. The SDK may download that package itself, and +a second download fails restore with NU1505. When multi-targeting, condition it, for example: + +```xml + + +``` + ### Example configuration ```xml @@ -46,10 +52,10 @@ IL weaver for adding nullability annotations to .NET Framework, .NET Standard, a - + - + ``` @@ -57,8 +63,8 @@ Minimal: ```xml - - + + ``` @@ -72,8 +78,8 @@ Minimal: ## Releases -[![NuGet](https://img.shields.io/nuget/v/TunnelVisionLabs.ReferenceAssemblyAnnotator.svg)](https://www.nuget.org/packages/TunnelVisionLabs.ReferenceAssemblyAnnotator) [![NuGet Beta](https://img.shields.io/nuget/vpre/TunnelVisionLabs.ReferenceAssemblyAnnotator.svg)](https://www.nuget.org/packages/TunnelVisionLabs.ReferenceAssemblyAnnotator/absoluteLatest) +[![NuGet](https://img.shields.io/nuget/vpre/ICSharpCode.ReferenceAssemblyAnnotator.svg)](https://www.nuget.org/packages/ICSharpCode.ReferenceAssemblyAnnotator) -* [Binaries (NuGet)](https://www.nuget.org/packages/TunnelVisionLabs.ReferenceAssemblyAnnotator) -* [Release Notes](https://github.com/tunnelvisionlabs/ReferenceAssemblyAnnotator/releases) -* [License](https://github.com/tunnelvisionlabs/ReferenceAssemblyAnnotator/blob/master/LICENSE) +* [Binaries (NuGet)](https://www.nuget.org/packages/ICSharpCode.ReferenceAssemblyAnnotator) +* [Release Notes](https://github.com/icsharpcode/ReferenceAssemblyAnnotator/releases) +* [License](https://github.com/icsharpcode/ReferenceAssemblyAnnotator/blob/master/LICENSE) diff --git a/ReferenceAssemblyAnnotator.sln b/ReferenceAssemblyAnnotator.sln index 0b31d2c..9e64bdb 100644 --- a/ReferenceAssemblyAnnotator.sln +++ b/ReferenceAssemblyAnnotator.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.29209.152 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CecilBasedAnnotator", "CecilBasedAnnotator\CecilBasedAnnotator.csproj", "{802A569B-9ABD-43C2-8A4D-4E9946023A44}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TunnelVisionLabs.ReferenceAssemblyAnnotator", "TunnelVisionLabs.ReferenceAssemblyAnnotator\TunnelVisionLabs.ReferenceAssemblyAnnotator.csproj", "{8133EC1F-B531-4094-A76E-F155E4117D30}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICSharpCode.ReferenceAssemblyAnnotator", "ICSharpCode.ReferenceAssemblyAnnotator\ICSharpCode.ReferenceAssemblyAnnotator.csproj", "{8133EC1F-B531-4094-A76E-F155E4117D30}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51FA6781-3E2C-4F33-9A73-D789899E93B6}" ProjectSection(SolutionItems) = preProject diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 26a6347..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,78 +0,0 @@ -version: '{build}' -image: Visual Studio 2019 -configuration: -- Debug -- Release -init: -- git config --global core.autocrlf true -before_build: -- nuget restore -skip_tags: true -build: - project: ReferenceAssemblyAnnotator.sln - verbosity: minimal -test_script: -- git clean -dxf tests -- msbuild /restore tests/MultiTFM /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/RefVersion3.1.0 /warnaserror /nr:false /v:m -- git clean -dxf tests -# No /warnaserror because WarningsNotAsErrors is not respected -- msbuild /restore tests/NoDisabledWarnings /p:TreatWarningsAsErrors=true /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=net35 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=net48 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netstandard1.6 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netstandard2.0 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netstandard2.1 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp1.0 /p:DisableImplicitNuGetFallbackFolder=true /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp1.1 /p:DisableImplicitNuGetFallbackFolder=true /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp2.0 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp2.1 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.0 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.1 /warnaserror /nr:false /v:m -- git clean -dxf tests -- msbuild /restore tests/WPF /warnaserror /nr:false /v:m - -- git clean -dxf tests -- dotnet msbuild -restore tests/MultiTFM -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/RefVersion3.1.0 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/NoDisabledWarnings -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=net35 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=net48 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netstandard1.6 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netstandard2.0 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netstandard2.1 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp1.0 -p:DisableImplicitNuGetFallbackFolder=true -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp1.1 -p:DisableImplicitNuGetFallbackFolder=true -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp2.0 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp2.1 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.0 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.1 -warnaserror -nr:false -v:m -- git clean -dxf tests -- dotnet msbuild -restore tests/WPF -warnaserror -nr:false -v:m -artifacts: -- path: 'TunnelVisionLabs.ReferenceAssemblyAnnotator\**\*.nupkg' diff --git a/build/test.ps1 b/build/test.ps1 new file mode 100644 index 0000000..51cccb1 --- /dev/null +++ b/build/test.ps1 @@ -0,0 +1,70 @@ +# Builds each sample project under tests/ against the locally built package. +# Run after building the solution with the same configuration. +param( + [string]$Configuration = 'Debug', + [ValidateSet('dotnet', 'msbuild')] + [string]$Engine = 'dotnet', + # NuGet packages folder for the test restores. Default: tests/.isolatednugetcache, wiped before every case. + # CI passes a short path outside the checkout instead (MAX_PATH under msbuild.exe); that is not wiped. + [string]$PackagesPath +) + +$ErrorActionPreference = 'Stop' +$root = Split-Path $PSScriptRoot -Parent +$tests = Join-Path $root 'tests' + +# tests/NuGet.Config resolves the local package source through this variable. +$env:CONFIGURATION = $Configuration + +# Set NUGET_PACKAGES explicitly: an inherited value (e.g. a machine-wide cache) overrides globalPackagesFolder in +# tests/NuGet.Config, and would then serve a stale annotator package with the same version as the one just built. +if (-not $PackagesPath) { $PackagesPath = Join-Path $tests '.isolatednugetcache' } +$env:NUGET_PACKAGES = $PackagesPath + +if ($Engine -eq 'msbuild') { + $msbuild = (Get-Command msbuild.exe -ErrorAction SilentlyContinue).Source + if (-not $msbuild) { + $vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' + $msbuild = & $vswhere -latest -prerelease -requires Microsoft.Component.MSBuild -find 'MSBuild\**\Bin\MSBuild.exe' | Select-Object -First 1 + } + if (-not $msbuild) { throw 'msbuild.exe not found' } +} + +$singleTfms = 'net35', 'net48', 'netstandard1.6', 'netstandard2.0', 'netstandard2.1', + 'netcoreapp1.0', 'netcoreapp1.1', 'netcoreapp2.0', 'netcoreapp2.1', 'netcoreapp3.0', 'netcoreapp3.1', 'net10.0' + +$cases = @( + @{ Project = 'MultiTFM'; Args = @('-warnaserror') } + @{ Project = 'RefVersion3.1.0'; Args = @('-warnaserror') } + # -warnaserror ignores WarningsNotAsErrors, so this one uses the property instead. + @{ Project = 'NoDisabledWarnings'; Args = @('-p:TreatWarningsAsErrors=true') } +) +foreach ($tfm in $singleTfms) { + $cases += @{ Project = 'SingleTFM'; Args = @('-warnaserror', "-p:TestFramework=$tfm") } +} +foreach ($markup in 'false', 'true') { + $cases += @{ Project = 'WPF'; Args = @('-warnaserror', "-p:IncludePackageReferencesDuringMarkupCompilation=$markup") } +} + +$failed = @() +foreach ($case in $cases) { + $name = "$($case.Project) $($case.Args -join ' ')" + Write-Host "=== [$Engine] $name" -ForegroundColor Cyan + + # Start clean so the isolated package cache never serves a stale package. + # longpaths: package cache paths exceed MAX_PATH on deep checkouts (e.g. GitHub runners). + git -C $root -c core.longpaths=true clean -dxfq -- tests + if ($LASTEXITCODE -ne 0) { throw 'git clean failed' } + + $buildArgs = @('-restore', (Join-Path $tests $case.Project), '-nr:false', '-v:m', "-p:Configuration=$Configuration") + $case.Args + if ($Engine -eq 'dotnet') { & dotnet msbuild @buildArgs } else { & $msbuild @buildArgs } + if ($LASTEXITCODE -ne 0) { $failed += $name } +} + +if ($failed.Count -gt 0) { + Write-Host "Failed ($($failed.Count)/$($cases.Count)):" -ForegroundColor Red + $failed | ForEach-Object { Write-Host " $_" -ForegroundColor Red } + exit 1 +} + +Write-Host "All $($cases.Count) test builds passed." -ForegroundColor Green diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 4efdfca..0000000 --- a/codecov.yml +++ /dev/null @@ -1,25 +0,0 @@ -# https://docs.codecov.io/docs/codecov-yaml -# https://github.com/codecov/support/wiki/Codecov-Yaml - -coverage: - status: - project: - default: false - patch: - default: false - -comment: - layout: "diff" - -flags: - production: - paths: - - TunnelVisionLabs.ReferenceAssemblyAnnotator/ - test: - paths: - - TunnelVisionLabs.ReferenceAssemblyAnnotator.Test/ - # Filter results to only show debug reports until the accuracy problems with - # the report merge process are fixed. - Release: - paths: - - nonexistent/ diff --git a/global.json b/global.json index 0b2cf8a..e9c718d 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,7 @@ { "sdk": { - "version": "3.1.100", - "rollForward": "latestFeature" + "version": "11.0.0", + "rollForward": "major", + "allowPrerelease": true } } diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 8c119d5..3ca9871 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -1,2 +1,11 @@ + + + + false + false + + $(MSBuildWarningsAsMessages);NETSDK1215 + + diff --git a/tests/MultiTFM/Class1.cs b/tests/MultiTFM/Class1.cs index 3671b38..09b33d8 100644 --- a/tests/MultiTFM/Class1.cs +++ b/tests/MultiTFM/Class1.cs @@ -13,7 +13,11 @@ public static void M(SqlConnection connection, [AllowNull] string? x) x.ToString(); } +#if !NETCOREAPP3_0_OR_GREATER + // The annotator removes [DisallowNull] from EqualityComparer.GetHashCode. .NET Core 3.0+ is not annotated, + // so its own [DisallowNull] applies there. _ = EqualityComparer.Default.GetHashCode(x); +#endif } } } diff --git a/tests/MultiTFM/MultiTFM.csproj b/tests/MultiTFM/MultiTFM.csproj index eccd7a4..c7deac3 100644 --- a/tests/MultiTFM/MultiTFM.csproj +++ b/tests/MultiTFM/MultiTFM.csproj @@ -1,7 +1,7 @@ - net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1 + net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net10.0 8 enable RA1000 @@ -17,15 +17,12 @@ $(NoWarn),CS1701 - - - - - - - + + + diff --git a/tests/NoDisabledWarnings/Class1.cs b/tests/NoDisabledWarnings/Class1.cs index 3671b38..09b33d8 100644 --- a/tests/NoDisabledWarnings/Class1.cs +++ b/tests/NoDisabledWarnings/Class1.cs @@ -13,7 +13,11 @@ public static void M(SqlConnection connection, [AllowNull] string? x) x.ToString(); } +#if !NETCOREAPP3_0_OR_GREATER + // The annotator removes [DisallowNull] from EqualityComparer.GetHashCode. .NET Core 3.0+ is not annotated, + // so its own [DisallowNull] applies there. _ = EqualityComparer.Default.GetHashCode(x); +#endif } } } diff --git a/tests/NoDisabledWarnings/NoDisabledWarnings.csproj b/tests/NoDisabledWarnings/NoDisabledWarnings.csproj index f2c3148..3e3ffb8 100644 --- a/tests/NoDisabledWarnings/NoDisabledWarnings.csproj +++ b/tests/NoDisabledWarnings/NoDisabledWarnings.csproj @@ -1,7 +1,7 @@ - net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1 + net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net10.0 8 enable RA1000 @@ -18,15 +18,12 @@ $(WarningsNotAsErrors),CS1701 - - - - - - - + + + diff --git a/tests/NuGet.Config b/tests/NuGet.Config index 57336da..c31846e 100644 --- a/tests/NuGet.Config +++ b/tests/NuGet.Config @@ -4,6 +4,18 @@ - + + + + + + + + + + + + + diff --git a/tests/RefVersion3.1.0/Class1.cs b/tests/RefVersion3.1.0/Class1.cs index 3671b38..09b33d8 100644 --- a/tests/RefVersion3.1.0/Class1.cs +++ b/tests/RefVersion3.1.0/Class1.cs @@ -13,7 +13,11 @@ public static void M(SqlConnection connection, [AllowNull] string? x) x.ToString(); } +#if !NETCOREAPP3_0_OR_GREATER + // The annotator removes [DisallowNull] from EqualityComparer.GetHashCode. .NET Core 3.0+ is not annotated, + // so its own [DisallowNull] applies there. _ = EqualityComparer.Default.GetHashCode(x); +#endif } } } diff --git a/tests/RefVersion3.1.0/RefVersion3.1.0.csproj b/tests/RefVersion3.1.0/RefVersion3.1.0.csproj index 842c3ec..55ad3e9 100644 --- a/tests/RefVersion3.1.0/RefVersion3.1.0.csproj +++ b/tests/RefVersion3.1.0/RefVersion3.1.0.csproj @@ -1,7 +1,7 @@ - net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1 + net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net10.0 8 enable RA1000 @@ -17,15 +17,12 @@ $(NoWarn),CS1701 - - - - - - - + + + diff --git a/tests/SingleTFM/Class1.cs b/tests/SingleTFM/Class1.cs index 3671b38..09b33d8 100644 --- a/tests/SingleTFM/Class1.cs +++ b/tests/SingleTFM/Class1.cs @@ -13,7 +13,11 @@ public static void M(SqlConnection connection, [AllowNull] string? x) x.ToString(); } +#if !NETCOREAPP3_0_OR_GREATER + // The annotator removes [DisallowNull] from EqualityComparer.GetHashCode. .NET Core 3.0+ is not annotated, + // so its own [DisallowNull] applies there. _ = EqualityComparer.Default.GetHashCode(x); +#endif } } } diff --git a/tests/SingleTFM/SingleTFM.csproj b/tests/SingleTFM/SingleTFM.csproj index bcb0e5e..a37e1ab 100644 --- a/tests/SingleTFM/SingleTFM.csproj +++ b/tests/SingleTFM/SingleTFM.csproj @@ -12,15 +12,12 @@ $(NoWarn),CS1701 - - - - - - - + + + diff --git a/tests/WPF/UserControl1.xaml b/tests/WPF/UserControl1.xaml index 097d3c5..234aa26 100644 --- a/tests/WPF/UserControl1.xaml +++ b/tests/WPF/UserControl1.xaml @@ -1,12 +1,3 @@  - - - - + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"/> \ No newline at end of file diff --git a/tests/WPF/UserControl1.xaml.cs b/tests/WPF/UserControl1.xaml.cs index fd690b9..4addbca 100644 --- a/tests/WPF/UserControl1.xaml.cs +++ b/tests/WPF/UserControl1.xaml.cs @@ -19,7 +19,11 @@ public static void M(SqlConnection connection, [AllowNull] string? x) x.ToString(); } +#if !NETCOREAPP3_0_OR_GREATER + // The annotator removes [DisallowNull] from EqualityComparer.GetHashCode. .NET Core 3.0+ is not annotated, + // so its own [DisallowNull] applies there. _ = EqualityComparer.Default.GetHashCode(x); +#endif } } } diff --git a/tests/WPF/WPF.csproj b/tests/WPF/WPF.csproj index 755582f..4fb52cd 100644 --- a/tests/WPF/WPF.csproj +++ b/tests/WPF/WPF.csproj @@ -1,9 +1,7 @@ - - net40;net48;netcoreapp3.0;netcoreapp3.1 + net35;net48;netcoreapp3.0;netcoreapp3.1;net10.0-windows true 8 enable @@ -11,9 +9,11 @@ - - - + + + + diff --git a/version.json b/version.json index 1434c9a..dcf8337 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.0.0-alpha.{height}", + "version": "2.0.0-preview.{height}", "assemblyVersion": { "precision": "minor" },