|
41 | 41 | </PropertyGroup>
|
42 | 42 |
|
43 | 43 | <Target Name="DecideIfWeNeedToIncludeDllSafeSearchPathAttribute"
|
44 |
| - Condition="'$(IsDotNetFrameworkProductAssembly)' == 'true' AND '$(IsTestProject)' != 'true'" |
45 |
| - BeforeTargets="GenerateAssemblyInfo"> |
| 44 | + Condition="'$(IsDotNetFrameworkProductAssembly)' == 'true' AND '$(IsTestProject)' != 'true'"> |
46 | 45 |
|
47 | 46 | <!-- We want to apply the IncludeDllSafeSearchPathAttribute on all DotNet assemblies (non test) that have a reference to System.Runtime.InteropServices -->
|
48 | 47 | <PropertyGroup Condition="'$(IncludeDllSafeSearchPathAttribute)'==''">
|
|
52 | 51 | </PropertyGroup>
|
53 | 52 | </Target>
|
54 | 53 |
|
55 |
| - <Target Name="GenerateAssemblyInfo" |
56 |
| - Inputs="$(MSBuildProjectFile)" |
57 |
| - Outputs="$(AssemblyInfoFile)" |
58 |
| - Condition="'$(GenerateAssemblyInfo)'=='true'" |
59 |
| - DependsOnTargets="CreateVersionFileDuringBuild"> |
60 |
| - |
61 |
| - <Error Condition="!Exists('$(IntermediateOutputPath)')" Text="GenerateAssemblyInfo failed because IntermediateOutputPath isn't set to a valid directory" /> |
62 |
| - |
63 |
| - <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'"> |
64 |
| - <AssemblyInfoUsings Include="using System%3B" /> |
65 |
| - <AssemblyInfoUsings Include="using System.Reflection%3B" /> |
66 |
| - <AssemblyInfoLines Include="[assembly:AssemblyTitle("$(AssemblyTitle)")]" /> |
67 |
| - <AssemblyInfoLines Include="[assembly:AssemblyDescription("$(Description)")]" /> |
68 |
| - <AssemblyInfoLines Include="[assembly:AssemblyDefaultAlias("$(AssemblyName)")]" /> |
69 |
| - <AssemblyInfoLines Include="[assembly:AssemblyCompany("$(Company)")]" /> |
70 |
| - <AssemblyInfoLines Include="[assembly:AssemblyProduct("$(Product)")]" /> |
71 |
| - <AssemblyInfoLines Include="[assembly:AssemblyCopyright("$(Copyright)")]" /> |
72 |
| - <AssemblyInfoLines Include="[assembly:AssemblyVersion("$(AssemblyVersion)")]" /> |
73 |
| - <AssemblyInfoLines Include="[assembly:AssemblyFileVersion("$(FileVersion)")]" /> |
74 |
| - <AssemblyInfoLines Include="[assembly:AssemblyInformationalVersion(@"$(InformationalVersion)")]" /> |
75 |
| - <AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="[assembly:CLSCompliant(true)]" /> |
76 |
| - <AssemblyInfoLines Condition="'$(AssemblyComVisible)'!=''" Include="[assembly:System.Runtime.InteropServices.ComVisible($(AssemblyComVisible))]" /> |
77 |
| - <AssemblyInfoLines Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true'" |
78 |
| - Include="[assembly:System.Reflection.AssemblyMetadata("%(AssemblyMetadata.Identity)", "%(AssemblyMetadata.Value)")]" /> |
79 |
| - |
80 |
| - <AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'" |
81 |
| - Include="[assembly: System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory | System.Runtime.InteropServices.DllImportSearchPath.System32)]" /> |
82 |
| - </ItemGroup> |
83 |
| - |
84 |
| - <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.vbproj'"> |
85 |
| - <AssemblyInfoUsings Include="Imports System" /> |
86 |
| - <AssemblyInfoUsings Include="Imports System.Reflection" /> |
87 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyTitle("$(AssemblyTitle)")>" /> |
88 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyDescription("$(Description)")>" /> |
89 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyDefaultAlias("$(AssemblyName)")>" /> |
90 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyCompany("$(Company)")>" /> |
91 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyProduct("$(Product)k")>" /> |
92 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyCopyright("$(Copyright)")>" /> |
93 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyVersion("$(AssemblyVersion)")>" /> |
94 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyFileVersion("$(FileVersion)")>" /> |
95 |
| - <AssemblyInfoLines Include="<Assembly:AssemblyInformationalVersion("$(InformationalVersion)")>" /> |
96 |
| - <AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="<Assembly:CLSCompliant(True)>" /> |
97 |
| - <AssemblyInfoLines Condition="'$(AssemblyComVisible)'!=''" Include="<Assembly:System.Runtime.InteropServices.ComVisible($(AssemblyComVisible))>" /> |
98 |
| - <AssemblyInfoLines Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true'" |
99 |
| - Include="<assembly:System.Reflection.AssemblyMetadata("%(AssemblyMetadata.Identity)", "%(AssemblyMetadata.Value)")>" /> |
100 |
| - |
101 |
| - <AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'" |
102 |
| - Include="<Assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory | System.Runtime.InteropServices.DllImportSearchPath.System32)>" /> |
103 |
| - </ItemGroup> |
104 |
| - |
105 |
| - <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj' And '$(GenerateThisAssemblyClass)' == 'true'"> |
106 |
| - <AssemblyInfoLines Include="internal static class ThisAssembly" /> |
107 |
| - <AssemblyInfoLines Include="{" /> |
108 |
| - <AssemblyInfoLines Include="%20%20%20%20internal const string Title = "$(AssemblyName)"%3B" /> |
109 |
| - <AssemblyInfoLines Include="%20%20%20%20internal const string Copyright = "\u00A9 Microsoft Corporation. All rights reserved."%3B" /> |
110 |
| - <AssemblyInfoLines Include="%20%20%20%20internal const string Version = "$(AssemblyVersion)"%3B" /> |
111 |
| - <AssemblyInfoLines Include="%20%20%20%20internal const string InformationalVersion = "$(AssemblyFileVersion)"%3B" /> |
112 |
| - <AssemblyInfoLines Include="}" /> |
113 |
| - </ItemGroup> |
114 |
| - |
115 |
| - <WriteLinesToFile |
116 |
| - File="$(AssemblyInfoFile)" |
117 |
| - Lines="@(AssemblyInfoUsings);@(AssemblyInfoLines);@(AssemblyInfoSource)" |
118 |
| - Overwrite="true" /> |
119 |
| - |
120 |
| - <ItemGroup> |
121 |
| - <Compile Include="$(AssemblyInfoFile)" /> |
122 |
| - <FileWrites Include="$(AssemblyInfoFile)" /> |
123 |
| - </ItemGroup> |
| 54 | + <PropertyGroup> |
| 55 | + <_GenerateAssemblyInfoTargetsFilePath Condition="'$(UsingMicrosoftNETSdk)' == 'true'">GenerateAssemblyInfo.Sdk.targets</_GenerateAssemblyInfoTargetsFilePath> |
| 56 | + <_GenerateAssemblyInfoTargetsFilePath Condition="'$(UsingMicrosoftNETSdk)' != 'true'">GenerateAssemblyInfo.NonSdk.targets</_GenerateAssemblyInfoTargetsFilePath> |
| 57 | + </PropertyGroup> |
124 | 58 |
|
125 |
| - </Target> |
| 59 | + <Import Project="$(_GenerateAssemblyInfoTargetsFilePath)" /> |
126 | 60 |
|
127 | 61 | <ItemGroup Condition="'$(GenerateAssemblyInfo)'=='true' AND '$(StringResourcesPath)' != '' AND '$(ExcludeAssemblyInfoPartialFile)' != 'true'">
|
128 | 62 | <Compile Include="$(AssemblyInfoPartialFile)">
|
|
0 commit comments