Skip to content

Commit 61cfbb3

Browse files
authored
Merge pull request #28 from KoalaBear84/patch-1
Add example to extract Assembly Metadata
2 parents 7d4dc8c + 24b4471 commit 61cfbb3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ If there are additional commands and output that are needed to be included in th
5656
</ItemGroup>
5757
```
5858

59+
### Extract Assembly Metadata
60+
61+
```csharp
62+
using System.Reflection;
63+
64+
string gitHash = Assembly
65+
.GetEntryAssembly()
66+
.GetCustomAttributes<AssemblyMetadataAttribute>()
67+
.FirstOrDefault(attr => attr.Key == "GitHash")?.Value;
68+
```
69+
5970
## Version History
6071
_2.0.2_
6172
- Fix issues introduced by changes from the Microsoft.NET.Sdk.

0 commit comments

Comments
 (0)