Add an MSBuild target to set MsBuild.exe path (#6401)
* Add an MSBuild target to set MsBuild.exe path * Added a warning message * Don't build Razor.Tasks twice * Compile include inside the target
This commit is contained in:
parent
1677ed2073
commit
3b67abecbf
|
|
@ -35,7 +35,6 @@
|
|||
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
|
||||
|
||||
<PropertyGroup>
|
||||
<GenerateNuspecDependsOn>_BuildDependencyProjects;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
|
||||
<BuildDependsOn>_BuildDependencyProjects;$(BuildDependsOn)</BuildDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
@ -92,7 +91,7 @@
|
|||
<Error Text="_RazorTool is empty. This is a bug" Condition="'@(_RazorTool)'==''" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PopulateNuspec" BeforeTargets="GenerateNuspec" DependsOnTargets="BuiltProjectOutputGroup;DebugSymbolsProjectOutputGroup;_BuildDependencyProjects">
|
||||
<Target Name="PopulateNuspec" BeforeTargets="GenerateNuspec" DependsOnTargets="BuiltProjectOutputGroup;DebugSymbolsProjectOutputGroup">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Make sure we create a symbols.nupkg. -->
|
||||
|
|
|
|||
|
|
@ -13,12 +13,10 @@
|
|||
<!-- Copy references locally so that we can use them in the test. -->
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<BuildVariablesGeneratedFile>$(MSBuildProjectDirectory)\obj\BuildVariables.generated.cs</BuildVariablesGeneratedFile>
|
||||
<CompileDependsOn>EnsureBuildVariablesGeneratedFile;$(CompileDependsOn)</CompileDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Compile Include="$(BuildVariablesGeneratedFile)" Condition="Exists('$(BuildVariablesGeneratedFile)')" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- The test projects rely on these binaries being available -->
|
||||
|
|
@ -35,8 +33,31 @@
|
|||
<Reference Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="EnsureBuildVariablesGeneratedFile">
|
||||
<Error Text="BuildVariables.generated.cs was not found. Run .\build /t:Prepare from the root of the repository to generate it." Condition="!Exists('$(BuildVariablesGeneratedFile)')" />
|
||||
<Target Name="GenerateBuildVariablesFile" BeforeTargets="BeforeBuild">
|
||||
<Warning Text="Some SDK tests on Windows require the project to be built once using Desktop MSBuild, but the current build is executed using .NET Core MSBuild. This may result in test failures."
|
||||
Condition="!Exists('$(BuildVariablesGeneratedFile)') and '$(MSBuildRuntimeType)' != 'Full' and '$(OS)' == 'Windows_NT'" />
|
||||
|
||||
<PropertyGroup>
|
||||
<GeneratedFileContents>
|
||||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||
{
|
||||
internal static partial class BuildVariables
|
||||
{
|
||||
static partial void InitializeVariables()
|
||||
{
|
||||
_msBuildPath = @"$(MSBuildBinPath)\MSBuild.exe"%3B
|
||||
}
|
||||
}
|
||||
}
|
||||
</GeneratedFileContents>
|
||||
</PropertyGroup>
|
||||
<WriteLinesToFile Lines="$(GeneratedFileContents)" File="$(BuildVariablesGeneratedFile)" Overwrite="true" WriteOnlyWhenDifferent="true" Condition="'$(MSBuildRuntimeType)' == 'Full'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="$(BuildVariablesGeneratedFile)" Condition="Exists('$(BuildVariablesGeneratedFile)')" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue