diff options
-rw-r--r-- | eng/BeforeTargetFrameworkInference.targets | 23 | ||||
-rw-r--r-- | src/libraries/Directory.Build.props | 5 | ||||
-rw-r--r-- | src/libraries/Directory.Build.targets | 1 | ||||
-rw-r--r-- | src/libraries/intellisense.targets | 85 | ||||
-rw-r--r-- | src/libraries/targetframeworksuffix.props (renamed from src/libraries/targetframework.props) | 8 |
5 files changed, 26 insertions, 96 deletions
diff --git a/eng/BeforeTargetFrameworkInference.targets b/eng/BeforeTargetFrameworkInference.targets new file mode 100644 index 00000000000..92adb5df635 --- /dev/null +++ b/eng/BeforeTargetFrameworkInference.targets @@ -0,0 +1,23 @@ +<Project> + + <PropertyGroup Condition="$(TargetFramework.Contains('-'))"> + <_OriginalTargetFramework>$(TargetFramework)</_OriginalTargetFramework> + <TargetFrameworkSuffix>$(TargetFramework.SubString($([MSBuild]::Add($(TargetFramework.IndexOf('-')), 1))))</TargetFrameworkSuffix> + <TargetFramework>$(TargetFramework.SubString(0, $(TargetFramework.IndexOf('-'))))</TargetFramework> + </PropertyGroup> + + <PropertyGroup> + <RefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', '$(TargetFramework)'))</RefPath> + </PropertyGroup> + + <Import Project="$(MSBuildThisDirectory)targetframeworksuffix.props" Condition="'$(DesignTimeBuild)' == 'true'" /> + + <PropertyGroup> + <IntermediateOutputPath>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)'))</IntermediateOutputPath> + <IntermediateOutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(Configuration)'))</IntermediateOutputPath> + <!-- setting the output paths --> + <OutputPath>$([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)'))</OutputPath> + <OutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(Configuration)'))</OutputPath> + </PropertyGroup> + +</Project> diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 1f9897bd036..a86add4cad9 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -12,6 +12,7 @@ </PropertyGroup> <PropertyGroup> + <BeforeTargetFrameworkInferenceTargets>$(RepositoryEngineeringDir)BeforeTargetFrameworkInference.targets</BeforeTargetFrameworkInferenceTargets> <ToolSetCommonDirectory>$(RepoRoot)artifacts\toolset\Common\</ToolSetCommonDirectory> <IsSourceProject>$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), 'src%24'))</IsSourceProject> <IsReferenceAssembly Condition="'$(IsReferenceAssembly)' == '' and ($(MSBuildProjectFullPath.Contains('\ref\')) or $(MSBuildProjectFullPath.Contains('/ref/')))">true</IsReferenceAssembly> @@ -169,8 +170,8 @@ <BaseIntermediateOutputPath Condition="'$(IsReferenceAssembly)' == 'true'">$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', '$(MSBuildProjectName)', 'ref'))</BaseIntermediateOutputPath> <BaseOutputPath Condition="'$(IsReferenceAssembly)' == 'true'">$([MSBuild]::NormalizeDirectory('$(AssemblyBinDirOutputPath)', 'ref'))</BaseOutputPath> </PropertyGroup> - - <Import Project="$(MSBuildThisDirectory)targetframework.props" Condition="'$(DesignTimeBuild)' != 'true'" /> + + <Import Project="$(MSBuildThisDirectory)targetframeworksuffix.props" Condition="'$(DesignTimeBuild)' != 'true'" /> <PropertyGroup> <!-- Always pass portable to override arcade sdk which uses embedded for local builds --> diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets index cc509afb394..7c2f62de0a7 100644 --- a/src/libraries/Directory.Build.targets +++ b/src/libraries/Directory.Build.targets @@ -30,7 +30,6 @@ <StrongNameKeyId Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true'">$(TestStrongNameKeyId)</StrongNameKeyId> </PropertyGroup> - <Import Project="$(MSBuildThisDirectory)intellisense.targets" Condition="'$(DesignTimeBuild)' == 'true'" /> <Import Project="$(RepositoryEngineeringDir)resources.targets" /> <Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" /> diff --git a/src/libraries/intellisense.targets b/src/libraries/intellisense.targets deleted file mode 100644 index 18a96aed6ea..00000000000 --- a/src/libraries/intellisense.targets +++ /dev/null @@ -1,85 +0,0 @@ -<Project> - <!-- We are reseting the target framework, so we need to reset the properties derived by the sdk - eg TargetFrameworkIdentifier, TargetFrameworkVersion. In order to do that we are copying the sdk - parsing code https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets#L47 - --> - <PropertyGroup> - <_UnsupportedTargetFrameworkError></_UnsupportedTargetFrameworkError> - <TargetFrameworkIdentifier></TargetFrameworkIdentifier> - <TargetFrameworkVersion></TargetFrameworkVersion> - <TargetFrameworkMoniker></TargetFrameworkMoniker> - <NuGetTargetMoniker></NuGetTargetMoniker> - </PropertyGroup> - - <PropertyGroup Condition="$(TargetFramework.Contains('-'))"> - <_OriginalTargetFramework>$(TargetFramework)</_OriginalTargetFramework> - <TargetFrameworkSuffix>$(TargetFramework.SubString($([MSBuild]::Add($(TargetFramework.IndexOf('-')), 1))))</TargetFrameworkSuffix> - <TargetFramework>$(TargetFramework.SubString(0, $(TargetFramework.IndexOf('-'))))</TargetFramework> - </PropertyGroup> - - <PropertyGroup> - <RefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', '$(TargetFramework)'))</RefPath> - </PropertyGroup> - - <!-- Split $(TargetFramework) (e.g. net45) into short identifier and short version (e.g. 'net' and '45'). --> - <PropertyGroup Condition="'$(TargetFramework)' != '' and !$(TargetFramework.Contains(',')) and !$(TargetFramework.Contains('+'))"> - <_ShortFrameworkIdentifier>$(TargetFramework.TrimEnd('.0123456789'))</_ShortFrameworkIdentifier> - <_ShortFrameworkVersion>$(TargetFramework.Substring($(_ShortFrameworkIdentifier.Length)))</_ShortFrameworkVersion> - </PropertyGroup> - - <!-- Versions with dots are taken as is and just given leading 'v'. --> - <PropertyGroup Condition="'$(TargetFrameworkVersion)' == '' and '$(_ShortFrameworkVersion)' != '' and $(_ShortFrameworkVersion.Contains('.'))"> - <TargetFrameworkVersion>v$(_ShortFrameworkVersion)</TargetFrameworkVersion> - </PropertyGroup> - - <!-- Versions with no dots and up to 3 characters get leading 'v' and implicit dots between characters. --> - <PropertyGroup Condition="'$(TargetFrameworkVersion)' == '' and '$(_ShortFrameworkVersion)' != ''"> - <TargetFrameworkVersion Condition="$(_ShortFrameworkVersion.Length) == 1">v$(_ShortFrameworkVersion[0]).0</TargetFrameworkVersion> - <TargetFrameworkVersion Condition="$(_ShortFrameworkVersion.Length) == 2">v$(_ShortFrameworkVersion[0]).$(_ShortFrameworkVersion[1])</TargetFrameworkVersion> - <TargetFrameworkVersion Condition="$(_ShortFrameworkVersion.Length) == 3">v$(_ShortFrameworkVersion[0]).$(_ShortFrameworkVersion[1]).$(_ShortFrameworkVersion[2])</TargetFrameworkVersion> - </PropertyGroup> - - <!-- Map short name to long name. See earlier comment for example of how to work with identifiers that are not recognized here. --> - <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == ''"> - <TargetFrameworkIdentifier Condition="'$(_ShortFrameworkIdentifier)' == 'netstandard'">.NETStandard</TargetFrameworkIdentifier> - <TargetFrameworkIdentifier Condition="'$(_ShortFrameworkIdentifier)' == 'netcoreapp'">.NETCoreApp</TargetFrameworkIdentifier> - - <!-- The meaning of "net" as a short framework name depends on the version. If it's 4.x or less, it means .NETFramework. - If the version is 5.0 or higher, then "net" means .NET 5.0 and on, which is the evolution of .NET Core, and uses - the .NETCoreApp TargetFrameworkIdentifier. --> - <TargetFrameworkIdentifier Condition="'$(_ShortFrameworkIdentifier)' == 'net' And - $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '5.0'))">.NETFramework</TargetFrameworkIdentifier> - <TargetFrameworkIdentifier Condition="'$(_ShortFrameworkIdentifier)' == 'net' And - $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '5.0'))">.NETCoreApp</TargetFrameworkIdentifier> - </PropertyGroup> - - <!-- - Trigger an error if we're unable to infer the framework identifier and version. - We have to evaluate this here and not in the target because by the time the target runs, - Microsoft.Common.targets will have defaulted to .NETFramework,Version=v4.0 - --> - <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '' or '$(TargetFrameworkVersion)' == ''"> - <_UnsupportedTargetFrameworkError>true</_UnsupportedTargetFrameworkError> - </PropertyGroup> - - <Import Project="$(MSBuildThisDirectory)targetframework.props" /> - - <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' != '' and '$(TargetFrameworkVersion)' != ''"> - <TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == '' and '$([System.String]::IsNullOrWhitespace($(TargetFrameworkProfile)))' != 'true'">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile)</TargetFrameworkMoniker> - <TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == ''">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)</TargetFrameworkMoniker> - </PropertyGroup> - - <PropertyGroup> - <!-- Note that the assets.cache file has contents that are unique to the current TFM and configuration and therefore cannot - be stored in a shared directory next to the assets.json file --> - <ProjectAssetsCacheFile Condition="'$(ProjectAssetsCacheFile)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).assets.cache</ProjectAssetsCacheFile> - <ProjectAssetsCacheFile>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(ProjectAssetsCacheFile)))</ProjectAssetsCacheFile> - <NuGetTargetMoniker>$(TargetFrameworkMoniker)</NuGetTargetMoniker> - <!-- We change the default value of the output path set by the sdk in our targetframework.props file. - We need to update the properties derived from the output path in order to reflect the change. - TargetPath is one of such property. --> - <TargetPath>$(OutputPath)$(TargetFileName)</TargetPath> - <OutDir>$(OutputPath)</OutDir> - </PropertyGroup> - -</Project> diff --git a/src/libraries/targetframework.props b/src/libraries/targetframeworksuffix.props index 3ee83b5d4aa..2f427328fd5 100644 --- a/src/libraries/targetframework.props +++ b/src/libraries/targetframeworksuffix.props @@ -74,12 +74,4 @@ </PropertyGroup> </When> </Choose> - <PropertyGroup> - <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)\</IntermediateOutputPath> - <IntermediateOutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$(BaseIntermediateOutputPath)$(TargetFramework)-$(Configuration)\</IntermediateOutputPath> - <!-- setting the output paths --> - <OutputPath>$(BaseOutputPath)$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)\</OutputPath> - <OutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$(BaseOutputPath)$(TargetFramework)-$(Configuration)\</OutputPath> - </PropertyGroup> - </Project> |