Skip to content

Commit

Permalink
Split restore and build to fix design time imports
Browse files Browse the repository at this point in the history
The restore and build target invocations need to happen in separate
msbuild task invocations and different global properties need to be
passed in to mitigate issues with caching the invocations. For more
context see dotnet/msbuild#2811.
  • Loading branch information
ViktorHofer committed Jan 14, 2020
1 parent b638594 commit 699ca67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
7 changes: 5 additions & 2 deletions eng/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
</ItemGroup>

<MSBuild Projects="@(RepoTaskProjects)"
Properties="Configuration=Debug;Platform=AnyCPU"
Targets="Restore;Build"/>
Properties="Configuration=Debug;Platform=AnyCPU;__BuildPhase=Restore"
Targets="Restore" />
<MSBuild Projects="@(RepoTaskProjects)"
Properties="Configuration=Debug;Platform=AnyCPU;__BuildPhase=Build"
Targets="Build"/>

<WriteLinesToFile File="$(RepoTasksOutputFile)"
Lines="$(RepoTasksOutputFile)"
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/tests/src/runtest.proj
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,18 @@ $(_XunitEpilog)

<Target Name="BuildXunitWrapper">
<!--
Restore and Build tasks shouldn't run in the same msbuild invocation as that could cause
issues with nuget auto-generated props/targets.
Restore and Build tasks shouldn't run in the same msbuild invocation as that could cause issues
with nuget auto-generated props/targets. https://github.com/microsoft/msbuild/issues/2811 for more context.
-->
<MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj" Targets="Restore" />
<MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj" Targets="Build" />
<ItemGroup>
<XUnitWrapperProjectFile Include="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj" />
</ItemGroup>
<MSBuild Projects="@(XUnitWrapperProjectFile)"
Targets="Restore"
Properties="__BuildPhase=Restore" />
<MSBuild Projects="@(XUnitWrapperProjectFile)"
Targets="Build"
Properties="__BuildPhase=Build" />
</Target>

<Import Project="$(MSBuildThisFileDirectory)../testgrouping.proj" />
Expand Down

0 comments on commit 699ca67

Please sign in to comment.