Repository navigation
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
103 lines (97 loc) · 6.21 KB
/
Copy pathDirectory.Build.props
File metadata and controls
103 lines (97 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<Project>
<!--
Release version guard, ZeroAlloc-Net/.github#36. Keep this block first in the file.
A package must never ship with a fallback version. Pack fails when:
ZAVERSION001 no version was supplied, so the package would carry a placeholder such as
the SDK default 1.0.0 or a csproj's 0.0.0-local;
ZAVERSION002 the assembly being packed does not carry the package's version. This is
how #26 shipped: build without -p:Version, then pack with no-build.
The marker below is read before the SDK or any csproj assigns a default, so it is true
only when the version came from outside the project: -p:Version or -p:PackageVersion.
Build, test and publish never run the check, in Debug or Release; only pack does.
-->
<PropertyGroup>
<ZeroAllocVersionSupplied Condition="'$(Version)$(PackageVersion)' != ''">true</ZeroAllocVersionSupplied>
</PropertyGroup>
<!-- BeforeTargets GenerateNuspec: after pack's build step, if any, before the nupkg is written. -->
<Target Name="ZeroAllocVerifyReleaseVersion"
BeforeTargets="GenerateNuspec"
Condition="'$(IsPackable)' == 'true'">
<Error Code="ZAVERSION001"
Condition="'$(ZeroAllocVersionSupplied)' != 'true'"
Text="$(MSBuildProjectName): no release version was supplied, so the package would ship as $(PackageVersion). Pass it on the command line: dotnet pack -c Release -p:Version=1.2.3. When packing with --no-build, pass -p:Version to the build step too." />
<!-- The assemblies that go into the package: one per target framework. -->
<ItemGroup>
<_ZeroAllocPackedTfm Include="$(TargetFrameworks)" Condition="'$(TargetFramework)' == ''" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="GetTargetPath"
Properties="TargetFramework=%(_ZeroAllocPackedTfm.Identity)"
Condition="'@(_ZeroAllocPackedTfm)' != ''">
<Output TaskParameter="TargetOutputs" ItemName="_ZeroAllocPackedAssembly" />
</MSBuild>
<ItemGroup>
<_ZeroAllocPackedAssembly Include="$(TargetPath)" Condition="'$(TargetFramework)' != ''" />
<_ZeroAllocPackedAssembly Remove="@(_ZeroAllocPackedAssembly)" Condition="!Exists('%(FullPath)')" />
</ItemGroup>
<GetAssemblyIdentity AssemblyFiles="@(_ZeroAllocPackedAssembly)">
<Output TaskParameter="Assemblies" ItemName="_ZeroAllocPackedIdentity" />
</GetAssemblyIdentity>
<!--
The SDK derives AssemblyVersion from Version. VersionEquals ignores prerelease and build
metadata and pads missing parts with 0, so 1.2.3-alpha.4 matches an assembly at 1.2.3.0.
-->
<Error Code="ZAVERSION002"
Condition="!$([MSBuild]::VersionEquals('%(_ZeroAllocPackedIdentity.Version)', '$(PackageVersion)'))"
Text="$(MSBuildProjectName): the built assembly %(_ZeroAllocPackedIdentity.Name) is version %(_ZeroAllocPackedIdentity.Version), but the package is $(PackageVersion), so the build did not get the release version. Pass -p:Version=$(PackageVersion) to every command that builds: dotnet build before a pack with --no-build, or dotnet pack itself. -p:PackageVersion alone labels the package without stamping the assembly." />
</Target>
<PropertyGroup>
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<NuGetAuditLevel>moderate</NuGetAuditLevel>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors>$(WarningsAsErrors);RS0016;RS0017</WarningsAsErrors>
<!-- Runs IDE code-style rules at build time, so .editorconfig can enforce IDE0250/IDE0251. -->
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<Authors>Marcel Roozekrans</Authors>
<Company>Marcel Roozekrans</Company>
<Copyright>Copyright (c) Marcel Roozekrans</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://notify.zeroalloc.net</PackageProjectUrl>
<RepositoryUrl>https://github.com/ZeroAlloc-Net/ZeroAlloc.Notify</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>notify;inotifypropertychanged;async;sourcegenerator;mvvm;zeroalloc;performance</PackageTags>
</PropertyGroup>
<!-- Debugging into the package: Go to Definition and step-into show the original source.
The PDB is embedded in each DLL, so consumers need no symbol server setting; Source Link,
built into the .NET SDK, maps it to this commit on GitHub. ContinuousIntegrationBuild
makes CI builds deterministic and writes /_/ paths instead of the runner's. It applies to
the shipped projects under src/ only: in a test project it would also turn CallerFilePath
into /_/..., which breaks tests that find snapshot files through it. -->
<PropertyGroup>
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true' and $(MSBuildProjectDirectory.StartsWith('$(MSBuildThisFileDirectory)src$([System.IO.Path]::DirectorySeparatorChar)'))">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup Condition="'$(IsPackable)' != 'false'">
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" Condition="Exists('$(MSBuildThisFileDirectory)README.md')" />
<None Include="$(MSBuildThisFileDirectory)assets\icon.png" Pack="true" PackagePath="\" Condition="Exists('$(MSBuildThisFileDirectory)assets\icon.png')" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="3.0.341" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Analyzers" Version="5.0.1" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="ZeroAlloc.Analyzers" Version="1.13.1" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>