Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ BenchmarkDotNet.Artifacts

# Nuke.build files
.nuke/build.schema.json
.nuke/temp

# AI agents
.claude/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ If you wish to preserve these attributes in the build output, you can define the
</PropertyGroup>

<!-- Add the package -->
<PackageReference Include="NetEscapades.EnumGenerators" Version="1.0.0-beta20" PrivateAssets="all" />
<PackageReference Include="NetEscapades.EnumGenerators" Version="1.0.0-beta20" />
<!-- ☝ You must not exclude the runtime assets in this case -->

</Project>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
<None Include="NetEscapades.EnumGenerators.targets" Pack="true" PackagePath="buildTransitive" Visible="true" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project>
<!--
Define NETESCAPADES_ENUMGENERATORS_USAGES so that the [Conditional] attribute on [EnumExtensions]
is satisfied. This preserves the attribute in IL, enabling usage analyzers to detect decorated
enums in referenced assemblies.

This targets file is only included in the meta-package, so it only runs when the meta-package is
referenced. We additionally verify the Attributes assembly will be available at runtime by checking
ReferenceCopyLocalPaths, which guards against unsupported configurations like ExcludeAssets="runtime".

Set EnumGenerator_PreserveAttributes to "false" to disable this behavior.

Note: using PrivateAssets="All" or ExcludeAssets="runtime" on the meta-package is not supported.
-->
<Target Name="NetEscapadesEnumGenerators_DefineUsages" AfterTargets="ResolveReferences" BeforeTargets="CoreCompile"
Condition="'$(EnumGenerator_PreserveAttributes)' != 'false'">
<PropertyGroup>
<DefineConstants Condition="'@(ReferenceCopyLocalPaths->AnyHaveMetadataValue(`FileName`, `NetEscapades.EnumGenerators.Attributes`))' == 'True'">$(DefineConstants);NETESCAPADES_ENUMGENERATORS_USAGES</DefineConstants>
</PropertyGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
OutputItemType="Analyzer" ReferenceOutputAssembly="true" />
</ItemGroup>

<Import Project="..\..\src\NetEscapades.EnumGenerators\NetEscapades.EnumGenerators.targets" />

<ItemGroup>
<Content Include="..\NetEscapades.EnumGenerators.IntegrationTests\xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
Expand Down
Loading