-
Notifications
You must be signed in to change notification settings - Fork 2
/
Directory.Build.targets
36 lines (30 loc) · 1.46 KB
/
Directory.Build.targets
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
<Project>
<!--
Use a technique to add assembly attributes with parameters inserted literally.
Credit to Anairkoen Schno: https://github.com/dotnet/msbuild/issues/2281#issuecomment-748082402
-->
<PropertyGroup>
<_LiteralAssemblyFile Condition="'$(Language)' == 'C#'">$(IntermediateOutputPath)LiteralAssemblyAttributes.cs</_LiteralAssemblyFile>
<CoreCompileDependsOn>
AddLiteralAssemblyAttributes;
$(CoreCompileDependsOn);
</CoreCompileDependsOn>
</PropertyGroup>
<Target Name="AddLiteralAssemblyAttributes"
BeforeTargets="CoreCompile"
Condition="'$(Language)' == 'C#'"
Inputs="$(MSBuildAllProjects)"
Outputs="$(_LiteralAssemblyFile)">
<ItemGroup>
<Compile Include="$(_LiteralAssemblyFile)" />
</ItemGroup>
<ItemGroup>
<_LiteralAssemblyAttrDecls Include="// <autogenerated />" />
<_LiteralAssemblyAttrDecls Include="extern alias %(LiteralAssemblyAttributeExternAlias.Identity);"
Condition="'%(LiteralAssemblyAttributeExternAlias.Identity)' != ''" />
<_LiteralAssemblyAttrDecls Include="[assembly: %(LiteralAssemblyAttribute.Identity)(%(LiteralAssemblyAttribute._Parameters))]"
Condition="'%(LiteralAssemblyAttribute.Identity)' != ''" />
</ItemGroup>
<WriteLinesToFile File="$(_LiteralAssemblyFile)" Encoding="UTF-8" Lines="@(_LiteralAssemblyAttrDecls)" Overwrite="true" />
</Target>
</Project>