Pass versions using MSBuild template instead of importing dependencies.props

This commit is contained in:
Pranav K 2018-06-05 10:53:58 -07:00
parent 41324bd37a
commit 754d7ba64e
6 changed files with 31 additions and 6 deletions

View File

@ -24,9 +24,8 @@
<PropertyGroup> <PropertyGroup>
<TemplateProperties> <TemplateProperties>
MSBuildLocation=$(VisualStudioMSBuildx86Path); MSBuildLocation=$(VisualStudioMSBuildx86Path);
MicrosoftNETCoreAppVersion=$(MicrosoftNETCoreApp22PackageVersion); MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreApp22PackageVersion);
MicrosoftNETCoreApp22PackageVersion=$(MicrosoftNETCoreApp22PackageVersion); NETStandardLibraryPackageVersion=$(NETStandardLibrary20PackageVersion)
NETStandardLibraryVersion=$(NETStandardLibrary20PackageVersion)
</TemplateProperties> </TemplateProperties>
</PropertyGroup> </PropertyGroup>

View File

@ -6,6 +6,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
internal static partial class BuildVariables internal static partial class BuildVariables
{ {
private static string _msBuildPath = string.Empty; private static string _msBuildPath = string.Empty;
private static string _microsoftNETCoreAppPackageVersion = string.Empty;
private static string _netStandardLibraryPackageVersion = string.Empty;
static partial void InitializeVariables(); static partial void InitializeVariables();
@ -17,5 +19,23 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
return _msBuildPath; return _msBuildPath;
} }
} }
public static string MicrosoftNETCoreAppPackageVersion
{
get
{
InitializeVariables();
return _microsoftNETCoreAppPackageVersion;
}
}
public static string NETStandardLibraryPackageVersion
{
get
{
InitializeVariables();
return _netStandardLibraryPackageVersion;
}
}
} }
} }

View File

@ -8,6 +8,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
static partial void InitializeVariables() static partial void InitializeVariables()
{ {
_msBuildPath = @"${MSBuildLocation}"; _msBuildPath = @"${MSBuildLocation}";
_microsoftNETCoreAppPackageVersion = "${MicrosoftNETCoreAppPackageVersion}";
_netStandardLibraryPackageVersion = "${NETStandardLibraryPackageVersion}";
} }
} }
} }

View File

@ -70,6 +70,9 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
// Let the test app know it is running as part of a test. // Let the test app know it is running as part of a test.
"/p:RunningAsTest=true", "/p:RunningAsTest=true",
$"/p:MicrosoftNETCoreAppVersion={BuildVariables.MicrosoftNETCoreAppPackageVersion}",
$"/p:NETStandardLibraryPackageVersion={BuildVariables.NETStandardLibraryPackageVersion}",
}; };
if (!suppressRestore) if (!suppressRestore)

View File

@ -10,13 +10,14 @@
<RazorSdkCurrentVersionTargets>$(SolutionRoot)src\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets</RazorSdkCurrentVersionTargets> <RazorSdkCurrentVersionTargets>$(SolutionRoot)src\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets</RazorSdkCurrentVersionTargets>
</PropertyGroup> </PropertyGroup>
<Import Project="$(SolutionRoot)build\dependencies.props" /> <!-- Import solution dependencies.props when building in place -->
<Import Project="..\..\build\dependencies.props" Condition="'$(BinariesRoot)'==''"/>
<PropertyGroup> <PropertyGroup>
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use --> <!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion> <NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
<NETStandardImplicitPackageVersion>$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion> <NETStandardImplicitPackageVersion>$(NETStandardLibraryPackageVersion)</NETStandardImplicitPackageVersion>
</PropertyGroup> </PropertyGroup>
<!-- Don't use the server when building in place. This locks up rzc.dll --> <!-- Don't use the server when building in place. This locks up rzc.dll -->

View File

@ -2,7 +2,7 @@
<Import Project="RazorTest.Introspection.targets" /> <Import Project="RazorTest.Introspection.targets" />
<PropertyGroup> <PropertyGroup>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.2' ">$(MicrosoftNETCoreApp22PackageVersion)</RuntimeFrameworkVersion> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.2' ">$(MicrosoftNETCoreAppVersion)</RuntimeFrameworkVersion>
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use --> <!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion> <NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
</PropertyGroup> </PropertyGroup>