Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing intellisense in vscode for src and ref projects #34025

Merged
merged 11 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 1 addition & 81 deletions src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,75 +51,6 @@
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
<BuildSettings Condition="'$(BuildSettings)' == ''">$(BuildTargetFramework)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</BuildSettings>
</PropertyGroup>

<Choose>
<When Condition="'$(TargetFrameworkSuffix)' == 'Windows_NT'">
<PropertyGroup>
<TargetsWindows>true</TargetsWindows>
<PackageTargetRuntime>win</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'Unix'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<PackageTargetRuntime>unix</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'Linux'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsLinux>true</TargetsLinux>
<PackageTargetRuntime>linux</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'Android'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsLinux>true</TargetsLinux>
<TargetsAndroid>true</TargetsAndroid>
<PackageTargetRuntime>android</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'OSX'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsOSX>true</TargetsOSX>
<PackageTargetRuntime>osx</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'iOS'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsiOS>true</TargetsiOS>
<PackageTargetRuntime>ios</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'FreeBSD'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsFreeBSD>true</TargetsFreeBSD>
<PackageTargetRuntime>freebsd</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'NetBSD'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsNetBSD>true</TargetsNetBSD>
<PackageTargetRuntime>netbsd</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'WebAssembly'">
<PropertyGroup>
<TargetsLinux>true</TargetsLinux>
<TargetsWebAssembly>true</TargetsWebAssembly>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == ''">
<PropertyGroup>
<TargetsAnyOS>true</TargetsAnyOS>
</PropertyGroup>
</When>
</Choose>

<!-- Define test projects and companions -->
<PropertyGroup>
Expand Down Expand Up @@ -208,13 +139,6 @@
<PackageRID Condition="'$(PackageRID)' == ''">$(RuntimeOS)-$(TargetArchitecture)</PackageRID>
</PropertyGroup>

<!-- Set some shortcuts for more terse conditions in project files -->
<PropertyGroup>
<TargetsNetCoreApp Condition="$(TargetFramework.StartsWith('netcoreapp'))">true</TargetsNetCoreApp>
<TargetsNetStandard Condition="$(TargetFramework.StartsWith('netstandard'))">true</TargetsNetStandard>
<TargetsNetFx Condition="$(TargetFramework.StartsWith('net4'))">true</TargetsNetFx>
</PropertyGroup>

<!-- set properties for each vertical -->
<PropertyGroup>
<BuildingNETCoreAppVertical Condition="'$(BuildingNETCoreAppVertical)' == '' and ('$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildAllConfigurations)' == 'true')">true</BuildingNETCoreAppVertical>
Expand All @@ -239,6 +163,7 @@

<!-- Import packaging props -->
<Import Project="$(RepositoryEngineeringDir)packaging.props" />
<Import Project="$(MSBuildThisDirectory)targetframework.props" Condition="'$(DesignTimeBuild)' != 'true'" />

<PropertyGroup>
<!-- Always pass portable to override arcade sdk which uses embedded for local builds -->
Expand Down Expand Up @@ -314,9 +239,7 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

<RuntimePath Condition="'$(RuntimePath)' == ''">$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'runtime', '$(BuildSettings)'))</RuntimePath>
<RefRootPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ref'))</RefRootPath>
<BuildTargetFrameworkRefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', '$(BuildTargetFramework)'))</BuildTargetFrameworkRefPath>
<RefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', '$(TargetFramework)'))</RefPath>
<NetStandard20RefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', 'netstandard2.0'))</NetStandard20RefPath>
<NetStandard21RefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', 'netstandard2.1'))</NetStandard21RefPath>
<NetFxRefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', '$(NetFrameworkCurrent)'))</NetFxRefPath>
Expand Down Expand Up @@ -348,9 +271,6 @@
<!-- setting the output paths -->
<OutputPath>$(BaseOutputPath)$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)\</OutputPath>
<OutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$(BaseOutputPath)$(TargetFramework)-$(Configuration)\</OutputPath>
<BaseIntermediateOutputPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', '$(MSBuildProjectName)'))</BaseIntermediateOutputPath>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should remain I think since it doesn’t need TargetFramework.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for move is same as #34025 (comment)

It will be nice to keep all IntermediateOutput path properties together.

<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$(BaseIntermediateOutputPath)$(TargetFramework)-$(Configuration)\</IntermediateOutputPath>
<AdditionalBuildTargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true' and '$(BuildAllProjects)' == 'true'">$(AdditionalBuildTargetFrameworks);netstandard2.0</AdditionalBuildTargetFrameworks>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<StrongNameKeyId Condition="'$(IsTestProject)' == '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" />

Expand Down
80 changes: 80 additions & 0 deletions src/libraries/intellisense.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<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>

<!-- 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>
<GeneratedAssemblyInfoFile>$(IntermediateOutputPath)$(MSBuildProjectName).AssemblyInfo$(DefaultLanguageSourceExtension)</GeneratedAssemblyInfoFile>
</PropertyGroup>

<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>
</PropertyGroup>

</Project>
85 changes: 85 additions & 0 deletions src/libraries/targetframework.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<Project>
<Choose>
<When Condition="'$(TargetFrameworkSuffix)' == 'Windows_NT'">
<PropertyGroup>
<TargetsWindows>true</TargetsWindows>
<PackageTargetRuntime>win</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'Unix'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<PackageTargetRuntime>unix</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'Linux'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsLinux>true</TargetsLinux>
<PackageTargetRuntime>linux</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'Android'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsLinux>true</TargetsLinux>
<TargetsAndroid>true</TargetsAndroid>
<PackageTargetRuntime>android</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'OSX'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsOSX>true</TargetsOSX>
<PackageTargetRuntime>osx</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'iOS'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsiOS>true</TargetsiOS>
<PackageTargetRuntime>ios</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'FreeBSD'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsFreeBSD>true</TargetsFreeBSD>
<PackageTargetRuntime>freebsd</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'NetBSD'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsNetBSD>true</TargetsNetBSD>
<PackageTargetRuntime>netbsd</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'WebAssembly'">
<PropertyGroup>
<TargetsLinux>true</TargetsLinux>
<TargetsWebAssembly>true</TargetsWebAssembly>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == ''">
<PropertyGroup>
<TargetsAnyOS>true</TargetsAnyOS>
</PropertyGroup>
</When>
</Choose>

<PropertyGroup>
<TargetsNetCoreApp Condition="$(TargetFramework.StartsWith('netcoreapp'))">true</TargetsNetCoreApp>
<TargetsNetStandard Condition="$(TargetFramework.StartsWith('netstandard'))">true</TargetsNetStandard>
<TargetsNetFx Condition="$(TargetFramework.StartsWith('net4'))">true</TargetsNetFx>
</PropertyGroup>

<PropertyGroup>
<RefRootPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ref'))</RefRootPath>
<RefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', '$(TargetFramework)'))</RefPath>
<BaseIntermediateOutputPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', '$(MSBuildProjectName)'))</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$(BaseIntermediateOutputPath)$(TargetFramework)-$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>

</Project>