Skip to content

Commit

Permalink
Use live runtime references for vcxproj
Browse files Browse the repository at this point in the history
Fixes #9490
Unblocks dotnet/sdk#43015

When building wpf inside the VMR, a 10.0.100 SDK is used. WPF currently still targets net9.0. As WPF directly depends on runtime, it already uses 10.0.0-alpha versions of the targeting and runtime packs for managed projects.

Enable this for vcxprojs as well so that the host packages can also be restored from the flowing runtime dependency.

Fixes errors like these:

> The Apphost pack is not installed and NuGet package restore is not supported. Upgrade Visual Studio, remove global.json if it specifies a certain SDK version, and uninstall the newer SDK. For more options visit   https://aka.ms/targeting-apphost-pack-missing  Pack Type:Apphost, Pack directory: D:\a\_work\1\vmr\.dotnet\packs\Microsoft.NETCore.App.Host.win-x64, targetframework: net9.0, Pack PackageId: Microsoft.NETCore.App.Host.win-x64, Pack Package Version: 9.0.0-rc.2.24473.5
  • Loading branch information
ViktorHofer committed Nov 4, 2024
1 parent 68baa81 commit 038bc30
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 19 deletions.
1 change: 1 addition & 0 deletions eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<!-- workaround for package downgrade in Microsoft.NetCore.Platforms -->
<PropertyGroup>
<DisableImplicitNETCorePlatformsReference>true</DisableImplicitNETCorePlatformsReference>
<EnableManagedPackageReferenceSupport>true</EnableManagedPackageReferenceSupport>
</PropertyGroup>

</Project>
18 changes: 4 additions & 14 deletions eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
Condition="'$(ManagedCxx)'=='true'"/>

<FrameworkReference Update="Microsoft.NETCore.App"
Condition="'$(MicrosoftNETCoreAppRefVersion)'!=''
And '$(NoTargets)'!='true'
And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'
And $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '3.0'))
And '$(MSBuildProjectExtension)'!='.vcxproj'">
<TargetingPackVersion>$(MicrosoftNETCoreAppRefVersion)</TargetingPackVersion>
Condition="'$(NoTargets)'!='true'
And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<TargetingPackVersion Condition="'$(MicrosoftNETCoreAppRefVersion)' != ''">$(MicrosoftNETCoreAppRefVersion)</TargetingPackVersion>
<RuntimeFrameworkVersion Condition="'$(MicrosoftNETCoreAppRuntimewinx64Version)' != ''">$(MicrosoftNETCoreAppRuntimewinx64Version)</RuntimeFrameworkVersion>
</FrameworkReference>

<!--
Expand All @@ -27,12 +25,4 @@
-->
<KnownFrameworkReference Remove="Microsoft.AspNetCore.App" />
</ItemGroup>

<PropertyGroup>
<RuntimeFrameworkVersion Condition="'$(MicrosoftNETCoreAppRuntimewinx64Version)'!='' And
'$(NoTargets)'!='true' And
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' And
$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '3.0')) And
'$(MSBuildProjectExtension)'!='.vcxproj'">$(MicrosoftNETCoreAppRuntimewinx64Version)</RuntimeFrameworkVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
</ItemGroup>
<PropertyGroup>
<UseDestinationLibFolder>true</UseDestinationLibFolder>
<TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
<RestoreProjectStyle>Unknown</RestoreProjectStyle>
<!--
Opting out of this to ensure _WindowsBaseReference is used as
OutputItemsType in the project reference later.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
</ItemGroup>
<PropertyGroup>
<UseDestinationLibFolder>true</UseDestinationLibFolder>
<TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<RestoreProjectStyle>Unknown</RestoreProjectStyle>
<!--
Opting out of this to ensure _defineReference is used as
OutputItemsType in the project references later.
Expand Down

0 comments on commit 038bc30

Please sign in to comment.