This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 240
Support using the Microsoft.NET.Sdk with dotnet/buildtools #2068
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/Microsoft.DotNet.Build.Tasks/PackageFiles/GenerateAssemblyInfo.NonSdk.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<Target Name="GenerateAssemblyInfo" | ||
Inputs="$(MSBuildProjectFile)" | ||
Outputs="$(AssemblyInfoFile)" | ||
Condition="'$(GenerateAssemblyInfo)'=='true'" | ||
DependsOnTargets="CreateVersionFileDuringBuild;DecideIfWeNeedToIncludeDllSafeSearchPathAttribute"> | ||
|
||
<Error Condition="!Exists('$(IntermediateOutputPath)')" Text="GenerateAssemblyInfo failed because IntermediateOutputPath isn't set to a valid directory" /> | ||
|
||
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'"> | ||
<AssemblyInfoUsings Include="using System%3B" /> | ||
<AssemblyInfoUsings Include="using System.Reflection%3B" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyTitle("$(AssemblyTitle)")]" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyDescription("$(Description)")]" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyDefaultAlias("$(AssemblyName)")]" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyCompany("$(Company)")]" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyProduct("$(Product)")]" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyCopyright("$(Copyright)")]" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyVersion("$(AssemblyVersion)")]" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyFileVersion("$(FileVersion)")]" /> | ||
<AssemblyInfoLines Include="[assembly:AssemblyInformationalVersion(@"$(InformationalVersion)")]" /> | ||
<AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="[assembly:CLSCompliant(true)]" /> | ||
<AssemblyInfoLines Condition="'$(AssemblyComVisible)'!=''" Include="[assembly:System.Runtime.InteropServices.ComVisible($(AssemblyComVisible))]" /> | ||
<AssemblyInfoLines Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true'" | ||
Include="[assembly:System.Reflection.AssemblyMetadata("%(AssemblyMetadata.Identity)", "%(AssemblyMetadata.Value)")]" /> | ||
|
||
<AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'" | ||
Include="[assembly: System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory | System.Runtime.InteropServices.DllImportSearchPath.System32)]" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.vbproj'"> | ||
<AssemblyInfoUsings Include="Imports System" /> | ||
<AssemblyInfoUsings Include="Imports System.Reflection" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyTitle("$(AssemblyTitle)")>" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyDescription("$(Description)")>" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyDefaultAlias("$(AssemblyName)")>" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyCompany("$(Company)")>" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyProduct("$(Product)k")>" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyCopyright("$(Copyright)")>" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyVersion("$(AssemblyVersion)")>" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyFileVersion("$(FileVersion)")>" /> | ||
<AssemblyInfoLines Include="<Assembly:AssemblyInformationalVersion("$(InformationalVersion)")>" /> | ||
<AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="<Assembly:CLSCompliant(True)>" /> | ||
<AssemblyInfoLines Condition="'$(AssemblyComVisible)'!=''" Include="<Assembly:System.Runtime.InteropServices.ComVisible($(AssemblyComVisible))>" /> | ||
<AssemblyInfoLines Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true'" | ||
Include="<assembly:System.Reflection.AssemblyMetadata("%(AssemblyMetadata.Identity)", "%(AssemblyMetadata.Value)")>" /> | ||
|
||
<AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'" | ||
Include="<Assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory | System.Runtime.InteropServices.DllImportSearchPath.System32)>" /> | ||
</ItemGroup> | ||
|
||
<WriteLinesToFile | ||
File="$(AssemblyInfoFile)" | ||
Lines="@(AssemblyInfoUsings);@(AssemblyInfoLines)" | ||
Overwrite="true" /> | ||
|
||
<ItemGroup> | ||
<Compile Include="$(AssemblyInfoFile)" /> | ||
<FileWrites Include="$(AssemblyInfoFile)" /> | ||
</ItemGroup> | ||
|
||
</Target> | ||
|
||
</Project> |
66 changes: 66 additions & 0 deletions
66
src/Microsoft.DotNet.Build.Tasks/PackageFiles/GenerateAssemblyInfo.Sdk.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<PropertyGroup> | ||
<!-- BuildTools never generated this attribute before, so don't let the SDK generate it. --> | ||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> | ||
|
||
<!-- | ||
When using the Microsoft.NET.Sdk, Company and Product are defaulted to $(AssemblyName) | ||
in Microsoft.NET.Sdk.BeforeCommon.targets, which means we would have to default them in | ||
a props file. However, the versioning.props file has to be imported during versioning.targets | ||
in order to get all the version properties set correctly. | ||
So overwrite these two properties here, so they are set correctly. | ||
--> | ||
<Company>Microsoft Corporation</Company> | ||
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong. |
||
<Product>Microsoft%AE .NET Framework</Product> | ||
</PropertyGroup> | ||
|
||
<Target Name="_ComputeBuildToolsAssemblyInfoAttributes" | ||
DependsOnTargets="CreateVersionFileDuringBuild;DecideIfWeNeedToIncludeDllSafeSearchPathAttribute" | ||
BeforeTargets="GetAssemblyAttributes"> | ||
<ItemGroup> | ||
<AssemblyAttribute Include="System.Reflection.AssemblyDefaultAliasAttribute"> | ||
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong. |
||
<_Parameter1>$(AssemblyName)</_Parameter1> | ||
</AssemblyAttribute> | ||
|
||
<AssemblyAttribute Include="System.Reflection.AssemblyMetadata" | ||
Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true'"> | ||
<_Parameter1>%(AssemblyMetadata.Identity)</_Parameter1> | ||
<_Parameter2>%(AssemblyMetadata.Value)</_Parameter2> | ||
</AssemblyAttribute> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<!-- 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" | ||
AfterTargets="CoreGenerateAssemblyInfo" | ||
Inputs="$(MSBuildProjectFile)" | ||
Outputs="$(AssemblyInfoFile)"> | ||
|
||
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'"> | ||
<AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="[assembly:System.CLSCompliant(true)]" /> | ||
|
||
<AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'" | ||
Include="[assembly: System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory | System.Runtime.InteropServices.DllImportSearchPath.System32)]" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.vbproj'"> | ||
<AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="<Assembly:System.CLSCompliant(True)>" /> | ||
|
||
<AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'" | ||
Include="<Assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory | System.Runtime.InteropServices.DllImportSearchPath.System32)>" /> | ||
</ItemGroup> | ||
|
||
<WriteLinesToFile File="$(AssemblyInfoFile)" | ||
Lines="@(AssemblyInfoLines)" | ||
Condition="'@(AssemblyInfoLines)' != ''" | ||
Overwrite="true" /> | ||
|
||
<ItemGroup Condition="'@(AssemblyInfoLines)' != ''"> | ||
<Compile Include="$(AssemblyInfoFile)" /> | ||
<FileWrites Include="$(AssemblyInfoFile)" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.