Make imports work without warnings or errors when the Sdk is referenced via MsBuild and package.

This commit is contained in:
Pranav K 2018-02-13 12:07:21 -08:00
parent 6be6229d18
commit 010b43cedf
4 changed files with 22 additions and 9 deletions

View File

@ -10,7 +10,5 @@ Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project ToolsVersion="14.0">
<Import Project="$(MSBuildThisFileDirectory)..\build\netstandard2.0\Sdk.Razor.CurrentVersion.props" />
<Import Project="$(MSBuildThisFileDirectory)..\build\netstandard2.0\Sdk.Razor.CurrentVersion.props" Condition="'$(_RazorSdkPackageReferenced)' != 'true'" />
</Project>

View File

@ -11,11 +11,11 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<Project ToolsVersion="14.0">
<PropertyGroup Condition="'$(RazorSdkTargetsPath)' == ''">
<RazorSdkTargetsPath Condition="'$(IsCrossTargetingBuild)' == 'true'">$(MSBuildThisFileDirectory)..\buildMultiTargeting\Sdk.Razor.CurrentVersion.MultiTargeting.targets</RazorSdkTargetsPath>
<RazorSdkTargetsPath Condition="'$(IsCrossTargetingBuild)' != 'true'">$(MSBuildThisFileDirectory)..\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets</RazorSdkTargetsPath>
<PropertyGroup>
<_RazorSdkTargetsPath Condition="'$(IsCrossTargetingBuild)' == 'true'">$(MSBuildThisFileDirectory)..\buildMultiTargeting\Sdk.Razor.CurrentVersion.MultiTargeting.targets</_RazorSdkTargetsPath>
<_RazorSdkTargetsPath Condition="'$(IsCrossTargetingBuild)' != 'true'">$(MSBuildThisFileDirectory)..\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets</_RazorSdkTargetsPath>
</PropertyGroup>
<Import Project="$(RazorSdkTargetsPath)" />
<Import Project="$(_RazorSdkTargetsPath)" Condition="'$(_RazorSdkPackageReferenced)' != 'true'" />
</Project>

View File

@ -13,7 +13,6 @@ Copyright (c) .NET Foundation. All rights reserved.
<Import Project="Sdk.Razor.CurrentVersion.props" />
<PropertyGroup>
<!-- Redirect the SDK to use the targets from the current package -->
<RazorSdkTargetsPath>$(MSBuildThisFileDirectory)Sdk.Razor.CurrentVersion.targets</RazorSdkTargetsPath>
<_RazorSdkPackageReferenced>true</_RazorSdkPackageReferenced>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,16 @@
<!--
***********************************************************************************************
Microsoft.Net.Sdk.Razor.props
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project ToolsVersion="14.0">
<PropertyGroup>
<_RazorSdkPackageReferenced>true</_RazorSdkPackageReferenced>
</PropertyGroup>
</Project>