diff options
author | Eric StJohn <ericstj@microsoft.com> | 2021-02-26 01:59:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-26 01:59:12 +0300 |
commit | 6a80a380a1644d962137ad62bc16067bc0dbfb72 (patch) | |
tree | 9d78179cbc27ed010c527085c234dde2c0b6b28f /eng/versioning.targets | |
parent | 9981ccb375ae019344cbb37708ecb437035875b7 (diff) |
Refactor how we generate some assembly attributes. (#48766)
Diffstat (limited to 'eng/versioning.targets')
-rw-r--r-- | eng/versioning.targets | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/eng/versioning.targets b/eng/versioning.targets index e6a3e7d1f0a..9e6d9de0718 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -53,17 +53,6 @@ </ItemGroup> </Target> - <Target Name="DecideIfWeNeedToIncludeDllSafeSearchPathAttribute" - Condition="'$(IsDotNetFrameworkProductAssembly)' == 'true' and '$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true'"> - - <!-- We want to apply the IncludeDllSafeSearchPathAttribute on all DotNet assemblies (non test) that have a reference to System.Runtime.InteropServices --> - <PropertyGroup Condition="'$(IncludeDllSafeSearchPathAttribute)'==''"> - <IncludeDllSafeSearchPathAttribute>false</IncludeDllSafeSearchPathAttribute> <!-- We don't need to include it by default. --> - <IncludeDllSafeSearchPathAttribute Condition="'%(ProjectReference.Filename)'=='System.Runtime.InteropServices'">true</IncludeDllSafeSearchPathAttribute> - <IncludeDllSafeSearchPathAttribute Condition="'%(Reference.Identity)'=='System.Runtime.InteropServices'">true</IncludeDllSafeSearchPathAttribute> - </PropertyGroup> - </Target> - <PropertyGroup> <!-- corefx has never generated these attributes so don't let the SDK generate them --> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> @@ -74,7 +63,6 @@ </PropertyGroup> <Target Name="_ComputeBuildToolsAssemblyInfoAttributes" - DependsOnTargets="DecideIfWeNeedToIncludeDllSafeSearchPathAttribute" BeforeTargets="GetAssemblyAttributes"> <ItemGroup> <AssemblyAttribute Include="System.Reflection.AssemblyDefaultAliasAttribute"> @@ -96,11 +84,22 @@ <!-- Work around https://github.com/Microsoft/msbuild/issues/3412 by writing the non-string assembly attributes manually --> <!-- Note: ReferenceAssemblies.targets still uses @(AssemblyInfoLines) as well. So if you remove this, those need to migrate too. --> <Target Name="_WriteNonStringAssemblyInfoAttributes" + DependsOnTargets="ResolveReferences" AfterTargets="CoreGenerateAssemblyInfo" BeforeTargets="BeforeCompile;CoreCompile" Inputs="$(MSBuildProjectFile)" Outputs="$(AssemblyInfoFile)"> + <!-- We want to apply the IncludeDllSafeSearchPathAttribute on all source assemblies that may contain DllImport --> + <PropertyGroup Condition="'$(IncludeDllSafeSearchPathAttribute)'=='' and '$(IsSourceProject)'== 'true'"> + <IncludeDllSafeSearchPathAttribute>false</IncludeDllSafeSearchPathAttribute> + <!-- We don't need to include it by default. --> + <IncludeDllSafeSearchPathAttribute Condition="'%(ReferencePath.Filename)' == 'System.Runtime.InteropServices'">true</IncludeDllSafeSearchPathAttribute> + <IncludeDllSafeSearchPathAttribute Condition="'%(ReferencePath.Filename)' == 'System.Private.CoreLib'">true</IncludeDllSafeSearchPathAttribute> + <IncludeDllSafeSearchPathAttribute Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard' and '%(ReferencePath.Filename)' == 'netstandard'">true</IncludeDllSafeSearchPathAttribute> + <IncludeDllSafeSearchPathAttribute Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '%(ReferencePath.Filename)' == 'mscorlib'">true</IncludeDllSafeSearchPathAttribute> + </PropertyGroup> + <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'"> <AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="[assembly:System.CLSCompliant(true)]" /> |