Consolidate RazorSdkDirectory logic (#22836)
* Consolidate RazorSdkDirectory logic
This commit is contained in:
parent
a2162e565f
commit
11c8ad4010
|
|
@ -14,9 +14,7 @@
|
||||||
<PackageReference Condition="'$(DotNetBuildFromSource)' != 'true'" Include="Microsoft.DotNet.GenAPI" PrivateAssets="All" Version="$(MicrosoftDotNetGenApiPackageVersion)" IsImplicitlyDefined="true" />
|
<PackageReference Condition="'$(DotNetBuildFromSource)' != 'true'" Include="Microsoft.DotNet.GenAPI" PrivateAssets="All" Version="$(MicrosoftDotNetGenApiPackageVersion)" IsImplicitlyDefined="true" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Choose>
|
<ItemGroup Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
|
||||||
<When Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
|
|
||||||
<ItemGroup>
|
|
||||||
<!--
|
<!--
|
||||||
Use the Razor SDK as a project reference. The version of the .NET Core SDK we build with often contains a version of the Razor SDK
|
Use the Razor SDK as a project reference. The version of the .NET Core SDK we build with often contains a version of the Razor SDK
|
||||||
several versions older than latest. We reference the project to ensure it's built before the other projects that use it. Since this
|
several versions older than latest. We reference the project to ensure it's built before the other projects that use it. Since this
|
||||||
|
|
@ -30,14 +28,10 @@
|
||||||
UndefineProperties="TargetFramework;TargetFrameworks" />
|
UndefineProperties="TargetFramework;TargetFrameworks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<ImportGroup Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
|
||||||
<RazorSdkDirectoryRoot>$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor\$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
|
<Import Project="$(RepoRoot)eng\targets\GetRazorSDKDirectory.props" />
|
||||||
</PropertyGroup>
|
<Import Project="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" />
|
||||||
</When>
|
</ImportGroup>
|
||||||
</Choose>
|
|
||||||
|
|
||||||
<Import Project="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''" />
|
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(IsTestProject)' == 'true' ">
|
<ItemGroup Condition=" '$(IsTestProject)' == 'true' ">
|
||||||
<Reference Include="Microsoft.AspNetCore.Testing" />
|
<Reference Include="Microsoft.AspNetCore.Testing" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<RazorSdkDirectoryRoot Condition="'$(RazorSdkDirectoryRoot)' == ''">$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor\$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -68,6 +68,10 @@
|
||||||
<_Parameter2>$(TargetFramework)</_Parameter2>
|
<_Parameter2>$(TargetFramework)</_Parameter2>
|
||||||
<_Parameter3></_Parameter3>
|
<_Parameter3></_Parameter3>
|
||||||
</AssemblyAttribute>
|
</AssemblyAttribute>
|
||||||
|
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
|
||||||
|
<_Parameter1>Test.RazorSdkDirectoryRoot</_Parameter1>
|
||||||
|
<_Parameter2>$(RazorSdkDirectoryRoot)</_Parameter2>
|
||||||
|
</AssemblyAttribute>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PrepareForTest" BeforeTargets="GetAssemblyAttributes" Condition="$(DesignTimeBuild) != true">
|
<Target Name="PrepareForTest" BeforeTargets="GetAssemblyAttributes" Condition="$(DesignTimeBuild) != true">
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,4 @@
|
||||||
Since this is a project reference, we must explicitly import the props file and also specify the output location of the SDK directory.
|
Since this is a project reference, we must explicitly import the props file and also specify the output location of the SDK directory.
|
||||||
-->
|
-->
|
||||||
<Import Project="${RepoRoot}src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''" />
|
<Import Project="${RepoRoot}src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''" />
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<RazorSdkDirectoryRoot>${ArtifactsBinDir}Microsoft.NET.Sdk.Razor\${Configuration}\sdk-output\</RazorSdkDirectoryRoot>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ namespace Templates.Test.Helpers
|
||||||
public string ProjectGuid { get; set; }
|
public string ProjectGuid { get; set; }
|
||||||
public string TemplateOutputDir { get; set; }
|
public string TemplateOutputDir { get; set; }
|
||||||
public string TargetFramework { get; set; } = GetAssemblyMetadata("Test.DefaultTargetFramework");
|
public string TargetFramework { get; set; } = GetAssemblyMetadata("Test.DefaultTargetFramework");
|
||||||
|
public string RazorSdkDirectoryRoot { get; set; } = GetAssemblyMetadata("Test.RazorSdkDirectoryRoot");
|
||||||
|
|
||||||
public string TemplateBuildDir => Path.Combine(TemplateOutputDir, "bin", "Debug", TargetFramework);
|
public string TemplateBuildDir => Path.Combine(TemplateOutputDir, "bin", "Debug", TargetFramework);
|
||||||
public string TemplatePublishDir => Path.Combine(TemplateOutputDir, "bin", "Release", TargetFramework, "publish");
|
public string TemplatePublishDir => Path.Combine(TemplateOutputDir, "bin", "Release", TargetFramework, "publish");
|
||||||
|
|
@ -116,7 +117,9 @@ namespace Templates.Test.Helpers
|
||||||
// Avoid restoring as part of build or publish. These projects should have already restored as part of running dotnet new. Explicitly disabling restore
|
// Avoid restoring as part of build or publish. These projects should have already restored as part of running dotnet new. Explicitly disabling restore
|
||||||
// should avoid any global contention and we can execute a build or publish in a lock-free way
|
// should avoid any global contention and we can execute a build or publish in a lock-free way
|
||||||
|
|
||||||
using var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), $"publish --no-restore -c Release /bl {additionalArgs}", packageOptions);
|
var razorSDKarg = string.IsNullOrEmpty(RazorSdkDirectoryRoot) ? string.Empty : $"/p:RazorSdkDirectoryRoot={RazorSdkDirectoryRoot}";
|
||||||
|
|
||||||
|
using var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), $"publish --no-restore -c Release /bl {razorSDKarg} {additionalArgs}", packageOptions);
|
||||||
await result.Exited;
|
await result.Exited;
|
||||||
CaptureBinLogOnFailure(result);
|
CaptureBinLogOnFailure(result);
|
||||||
return new ProcessResult(result);
|
return new ProcessResult(result);
|
||||||
|
|
@ -129,7 +132,9 @@ namespace Templates.Test.Helpers
|
||||||
// Avoid restoring as part of build or publish. These projects should have already restored as part of running dotnet new. Explicitly disabling restore
|
// Avoid restoring as part of build or publish. These projects should have already restored as part of running dotnet new. Explicitly disabling restore
|
||||||
// should avoid any global contention and we can execute a build or publish in a lock-free way
|
// should avoid any global contention and we can execute a build or publish in a lock-free way
|
||||||
|
|
||||||
using var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), $"build --no-restore -c Debug /bl {additionalArgs}", packageOptions);
|
var razorSDKarg = string.IsNullOrEmpty(RazorSdkDirectoryRoot) ? string.Empty : $"/p:RazorSdkDirectoryRoot={RazorSdkDirectoryRoot}";
|
||||||
|
|
||||||
|
using var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), $"build --no-restore -c Debug /bl {razorSDKarg} {additionalArgs}", packageOptions);
|
||||||
await result.Exited;
|
await result.Exited;
|
||||||
CaptureBinLogOnFailure(result);
|
CaptureBinLogOnFailure(result);
|
||||||
return new ProcessResult(result);
|
return new ProcessResult(result);
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,4 @@
|
||||||
must explicitly import the props file and also specify the output location of the SDK directory.
|
must explicitly import the props file and also specify the output location of the SDK directory.
|
||||||
-->
|
-->
|
||||||
<Import Project="${RepoRoot}src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''" />
|
<Import Project="${RepoRoot}src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''" />
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<RazorSdkDirectoryRoot>${ArtifactsBinDir}Microsoft.NET.Sdk.Razor\${Configuration}\sdk-output\</RazorSdkDirectoryRoot>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
<!-- Shared testing infrastructure for running E2E tests using selenium -->
|
<!-- Shared testing infrastructure for running E2E tests using selenium -->
|
||||||
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.props" />
|
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.props" />
|
||||||
|
<Import Project="$(RepoRoot)eng\targets\GetRazorSDKDirectory.props" Condition="'$(IsHelixJob)' != 'true'"/>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
||||||
|
|
@ -61,6 +62,10 @@
|
||||||
<_Parameter1>Test.DefaultTargetFramework</_Parameter1>
|
<_Parameter1>Test.DefaultTargetFramework</_Parameter1>
|
||||||
<_Parameter2>$(DefaultNetCoreTargetFramework)</_Parameter2>
|
<_Parameter2>$(DefaultNetCoreTargetFramework)</_Parameter2>
|
||||||
</AssemblyAttribute>
|
</AssemblyAttribute>
|
||||||
|
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
|
||||||
|
<_Parameter1>Test.RazorSdkDirectoryRoot</_Parameter1>
|
||||||
|
<_Parameter2>$(RazorSdkDirectoryRoot)</_Parameter2>
|
||||||
|
</AssemblyAttribute>
|
||||||
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
|
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
|
||||||
<_Parameter1>ContinuousIntegrationBuild</_Parameter1>
|
<_Parameter1>ContinuousIntegrationBuild</_Parameter1>
|
||||||
<_Parameter2>true</_Parameter2>
|
<_Parameter2>true</_Parameter2>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue