-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathreadme.txt
More file actions
51 lines (36 loc) · 2.06 KB
/
Copy pathreadme.txt
File metadata and controls
51 lines (36 loc) · 2.06 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
# AssemblyMetadata.Generators
Source generator to expose assembly attributes as string constants.
[](https://github.com/loresoft/AssemblyMetadata.Generators/actions)
[](https://www.nuget.org/packages/AssemblyMetadata.Generators/)
[](https://coveralls.io/github/loresoft/AssemblyMetadata.Generators?branch=main)
### Usage
#### Add package
Add the nuget package project to your projects.
`dotnet add package AssemblyMetadata.Generators`
### Generated
This source generator creates an internal partial class called `ThisAssembly` with all the assembly level attributes converted to string constants
```c#
internal static partial class ThisAssembly
{
public const string TargetFramework = ".NETCoreApp,Version=v7.0";
public const string Company = "LoreSoft";
public const string Configuration = "Debug";
public const string Copyright = "Copyright © 2023 LoreSoft";
public const string Description = "Source generator to expose assembly attributes as string constants";
public const string FileVersion = "1.0.0.0";
public const string InformationalVersion = "1.0.0";
public const string Product = "AssemblyMetadata.Generators.Tests";
public const string Title = "AssemblyMetadata.Generators.Tests";
public const string Version = "1.0.0.0";
public const string RepositoryUrl = "https://github.com/loresoft/AssemblyMetadata.Generators";
public const string NeutralResourcesLanguage = "en-US";
}
```
### Namespace
Set the `ThisAssemblyNamespace` MSBuild property to set the namespace of the generated `ThisAssembly` class. Otherwise, it will be in the global namespace.
Put `ThisAssembly` in the projects root namespace.
```xml
<PropertyGroup>
<ThisAssemblyNamespace>$(RootNamespace)</ThisAssemblyNamespace>
</PropertyGroup>
```