Skip to content

Commit 105fe3e

Browse files
authored
LAMBJ-152 Package Version Attribute (#554)
Adds a package version attribute to assemblies called LambdajectionVersion
1 parent 92d6a33 commit 105fe3e

File tree

8 files changed

+43
-1
lines changed

8 files changed

+43
-1
lines changed

.github/releases/v0.10.0-beta2.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Enhancements
2+
3+
- Adds an attribute to each Lambdajection assembly called `LambdajectionVersion` which can be used to retrieve the NuGet Package Version of Lambdajection being used.

Directory.Build.props

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,14 @@
4848
<ItemGroup>
4949
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Visible="false" />
5050
</ItemGroup>
51+
<ItemGroup>
52+
<AdditionalThisAssemblyFields Include="NuGetPackageVersion" String="$(NuGetPackageVersion)" />
53+
</ItemGroup>
54+
<Target Name="AddNuGetPackageVersionToThisAssembly" DependsOnTargets="GetBuildVersion" BeforeTargets="GenerateAssemblyNBGVVersionInfo" Condition="'$(SkipAddNuGetPackageVersionToThisAssembly)' != 'true'">
55+
<ItemGroup>
56+
<AssemblyAttribute Include="Lambdajection.Framework.LambdajectionVersion">
57+
<_Parameter1>$(NuGetPackageVersion)</_Parameter1>
58+
</AssemblyAttribute>
59+
</ItemGroup>
60+
</Target>
5161
</Project>

src/Encryption/Encryption.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
<ItemGroup>
2222
<None Include="build/**" Pack="true" PackagePath="build/" />
2323
</ItemGroup>
24-
</Project>
24+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
3+
namespace Lambdajection.Framework
4+
{
5+
/// <summary>
6+
/// Attribute for annotating assemblies with the lambdajection package version.
7+
/// </summary>
8+
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
9+
public class LambdajectionVersionAttribute : Attribute
10+
{
11+
/// <summary>
12+
/// Initializes a new instance of the <see cref="LambdajectionVersionAttribute" /> class.
13+
/// </summary>
14+
/// <param name="version">Version of the lambdajection package.</param>
15+
public LambdajectionVersionAttribute(string version)
16+
{
17+
Version = version;
18+
}
19+
20+
/// <summary>
21+
/// Gets the version of the Lambdajection package.
22+
/// </summary>
23+
public string Version { get; }
24+
}
25+
}

src/Generator/Generator.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<NoWarn>NU5118;CS8618;NU5128;CS1591;CA1062</NoWarn>
1212
<BuildOutputTargetFolder>analyzers/dotnet/cs</BuildOutputTargetFolder>
1313
<DevelopmentDependency>true</DevelopmentDependency>
14+
<SkipAddNuGetPackageVersionToThisAssembly>true</SkipAddNuGetPackageVersionToThisAssembly>
1415
<PackageDescription>Includes the compile-time generator used to generate code needed for Dependency Injection-enabled AWS Lambdas.</PackageDescription>
1516
<BeforePack>IncludeExtraPackItems</BeforePack>
1617
</PropertyGroup>

src/Runtime/Runtime.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<PackageId>Lambdajection.Runtime</PackageId>
66
<AssemblyName>$(PackageId)</AssemblyName>
77
<NoWarn>NU5128</NoWarn>
8+
<SkipAddNuGetPackageVersionToThisAssembly>true</SkipAddNuGetPackageVersionToThisAssembly>
89
<PackageDescription>Sets Lambdajection projects up to support custom runtimes.</PackageDescription>
910
</PropertyGroup>
1011

src/Templates/Templates.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<IncludeContentInPack>true</IncludeContentInPack>
1111
<PackageDescription>Includes templates for creating Lambdajection projects and components.</PackageDescription>
1212
<BeforePack>CopyTemplates;PrepareTemplates</BeforePack>
13+
<SkipAddNuGetPackageVersionToThisAssembly>true</SkipAddNuGetPackageVersionToThisAssembly>
1314
</PropertyGroup>
1415

1516
<ItemGroup>

src/Tracing/Tracing.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<AssemblyName>$(PackageId)</AssemblyName>
66
<NoWarn>NU5128</NoWarn>
77
<IncludeBuildOutput>false</IncludeBuildOutput>
8+
<SkipAddNuGetPackageVersionToThisAssembly>true</SkipAddNuGetPackageVersionToThisAssembly>
89
<PackageDescription>Adds X-Ray Tracing Support to Lambdajection.</PackageDescription>
910
</PropertyGroup>
1011

0 commit comments

Comments
 (0)