Skip to content

Commit 879df78

Browse files
ericstjakoeplinger
andauthored
Fix DotnetSharedFrameworkTaskDir to not rely on DotnetBuildFromSource (#8355) (#8597)
After #8338 we saw a build error in a dotnet/runtime build job that tries to validate source-build but still uses the non-source-built arcade packages: ``` /__w/1/s/artifacts/source-build/self/src/src/libraries/ref.proj(68,5): error MSB4062: The "CreateFrameworkListFile" task could not be loaded from the assembly /__w/1/s/artifacts/source-build/self/package-cache/microsoft.dotnet.sharedframework.sdk/7.0.0-beta.22064.25/sdk/../tools/net6.0/Microsoft.DotNet.SharedFramework.Sdk.dll. Could not load file or assembly '/__w/1/s/artifacts/source-build/self/package-cache/microsoft.dotnet.sharedframework.sdk/7.0.0-beta.22064.25/tools/net6.0/Microsoft.DotNet.SharedFramework.Sdk.dll'. The system cannot find the file specified. ``` This is because the non-source-built arcade packages use netcoreapp3.1 libraries instead of net6.0, but we're still setting DotnetBuildFromSource=true in those builds. Instead of using DotnetBuildFromSource to switch between libraries we can check for the existence of the net6.0 folder which works in both scenarios. Co-authored-by: Alexander Köplinger <[email protected]>
1 parent 4f4c8c3 commit 879df78

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • src/Microsoft.DotNet.SharedFramework.Sdk/sdk

src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
-->
99

1010
<PropertyGroup Condition="'$(DotNetSharedFrameworkTaskDir)' == ''">
11-
<DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' == 'core'">$(MSBuildThisFileDirectory)../tools/netcoreapp3.1/</DotNetSharedFrameworkTaskDir>
12-
<DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' != 'core'">$(MSBuildThisFileDirectory)../tools/net472/</DotNetSharedFrameworkTaskDir>
13-
1411
<!-- Workaround for https://github.com/dotnet/arcade/issues/7413 -->
15-
<DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' == 'core' and '$(DotNetBuildFromSource)' == 'true'">$(MSBuildThisFileDirectory)../tools/net6.0/</DotNetSharedFrameworkTaskDir>
12+
<DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' == 'core' and Exists('$(MSBuildThisFileDirectory)../tools/net6.0/')">$(MSBuildThisFileDirectory)../tools/net6.0/</DotNetSharedFrameworkTaskDir>
13+
<DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' == 'core' and '$(DotNetSharedFrameworkTaskDir)' == ''">$(MSBuildThisFileDirectory)../tools/netcoreapp3.1/</DotNetSharedFrameworkTaskDir>
14+
<DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' != 'core'">$(MSBuildThisFileDirectory)../tools/net472/</DotNetSharedFrameworkTaskDir>
1615
</PropertyGroup>
1716

1817
<PropertyGroup>

0 commit comments

Comments
 (0)