|
13 | 13 | <!-- Copy references locally so that we can use them in the test. -->
|
14 | 14 | <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
15 | 15 | <BuildVariablesGeneratedFile>$(MSBuildProjectDirectory)\obj\BuildVariables.generated.cs</BuildVariablesGeneratedFile>
|
16 |
| - <CompileDependsOn>EnsureBuildVariablesGeneratedFile;$(CompileDependsOn)</CompileDependsOn> |
17 | 16 | </PropertyGroup>
|
18 | 17 |
|
19 | 18 | <ItemGroup>
|
20 | 19 | <None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
|
21 |
| - <Compile Include="$(BuildVariablesGeneratedFile)" Condition="Exists('$(BuildVariablesGeneratedFile)')" /> |
22 | 20 | </ItemGroup>
|
23 | 21 |
|
24 | 22 | <!-- The test projects rely on these binaries being available -->
|
|
35 | 33 | <Reference Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib" />
|
36 | 34 | </ItemGroup>
|
37 | 35 |
|
38 |
| - <Target Name="EnsureBuildVariablesGeneratedFile"> |
39 |
| - <Error Text="BuildVariables.generated.cs was not found. Run .\build /t:Prepare from the root of the repository to generate it." Condition="!Exists('$(BuildVariablesGeneratedFile)')" /> |
| 36 | + <Target Name="GenerateBuildVariablesFile" BeforeTargets="BeforeBuild"> |
| 37 | + <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." |
| 38 | + Condition="!Exists('$(BuildVariablesGeneratedFile)') and '$(MSBuildRuntimeType)' != 'Full' and '$(OS)' == 'Windows_NT'" /> |
| 39 | + |
| 40 | + <PropertyGroup> |
| 41 | + <GeneratedFileContents> |
| 42 | +// Copyright (c) .NET Foundation. All rights reserved. |
| 43 | +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. |
| 44 | + |
| 45 | +namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests |
| 46 | +{ |
| 47 | + internal static partial class BuildVariables |
| 48 | + { |
| 49 | + static partial void InitializeVariables() |
| 50 | + { |
| 51 | + _msBuildPath = @"$(MSBuildBinPath)\MSBuild.exe"%3B |
| 52 | + } |
| 53 | + } |
| 54 | +} |
| 55 | + </GeneratedFileContents> |
| 56 | + </PropertyGroup> |
| 57 | + <WriteLinesToFile Lines="$(GeneratedFileContents)" File="$(BuildVariablesGeneratedFile)" Overwrite="true" WriteOnlyWhenDifferent="true" Condition="'$(MSBuildRuntimeType)' == 'Full'" /> |
| 58 | + <ItemGroup> |
| 59 | + <Compile Include="$(BuildVariablesGeneratedFile)" Condition="Exists('$(BuildVariablesGeneratedFile)')" /> |
| 60 | + </ItemGroup> |
40 | 61 | </Target>
|
41 | 62 |
|
42 | 63 | </Project>
|
0 commit comments