-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathThisAssembly.Metadata.csproj
More file actions
56 lines (43 loc) · 1.52 KB
/
ThisAssembly.Metadata.csproj
File metadata and controls
56 lines (43 loc) · 1.52 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
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<IsRoslynComponent>true</IsRoslynComponent>
<PackBuildOutput>false</PackBuildOutput>
</PropertyGroup>
<PropertyGroup>
<PackageId>ThisAssembly.Metadata</PackageId>
<Description>
This package generates a static `ThisAssembly.Metadata` class with public
constants exposing each `[System.Reflection.AssemblyMetadata(..)]` defined for the project,
such as when using .NET 5.0+ support for `AssemblyMetadata` MSBuild items.
So for an attribute like:
[assembly: System.Reflection.AssemblyMetadataAttribute("Foo", "Bar")]
A corresponding `ThisAssembly.Metadata.Foo` constant with the value `Bar` is provided.
The metadata attribute can alternatively be declared using MSBuild in the project
(for .NET 5.0+ projects):
<ItemGroup>
<AssemblyMetadata Include="Foo" Value="Bar" />
</ItemGroup>
Generated code:
C#:
partial class ThisAssembly
{
public static partial class Metadata
{
public const string Foo = "Bar";
}
}
</Description>
</PropertyGroup>
<ItemGroup>
<None Remove="ThisAssembly.Metadata.targets" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NuGetizer" Version="1.4.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ThisAssembly.Constants\ThisAssembly.Constants.csproj" />
</ItemGroup>
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
</Project>