Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use live runtime references for vcxproj #10028

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Nov 4, 2024

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

Fixes #

Main PR

Description

Customer Impact

Regression

Testing

Risk

Microsoft Reviewers: Open in CodeFlow

@ViktorHofer ViktorHofer requested review from a team as code owners November 4, 2024 07:27
@dotnet-policy-service dotnet-policy-service bot added the PR metadata: Label to tag PRs, to facilitate with triage label Nov 4, 2024
@ViktorHofer ViktorHofer marked this pull request as draft November 4, 2024 09:30
@ViktorHofer
Copy link
Member Author

Unfortunately this doesn't work:

C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(751,5): error : Unexpected failure reading NuGet.Confi
g. Path: 'C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config'. [C:\git\wpf\src\Microsoft.DotNet.Wpf\src\Themes\PresentationFramework.Luna\Presen
tationFramework.Luna.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(751,5): error :   The process cannot access the file '
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config' because it is being used by another process. [C:\git\wpf\src\Microsoft.DotNet.Wpf\src\Themes
\PresentationFramework.Luna\PresentationFramework.Luna.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(751,5): error : Unexpected failure reading NuGet.Confi
g. Path: 'C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config'. [C:\git\wpf\src\Microsoft.DotNet.Wpf\tests\UnitTests\System.Xaml.Tests\System.Xam
l.Tests.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(751,5): error :   The process cannot access the file '
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config' because it is being used by another process. [C:\git\wpf\src\Microsoft.DotNet.Wpf\tests\Unit
Tests\System.Xaml.Tests\System.Xaml.Tests.csproj]

cc @ericstj as you might have ideas

@ViktorHofer
Copy link
Member Author

Submitted #10030 as a workaround until this PR gets in.

@ericstj
Copy link
Member

ericstj commented Nov 4, 2024

That error is odd - I would expect that file to be opened for read only (since build processes should never write to such global files) - I wonder if NuGet is missing a sharing permission when opening this file?

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
@ViktorHofer
Copy link
Member Author

That error is odd - I would expect that file to be opened for read only (since build processes should never write to such global files) - I wonder if NuGet is missing a sharing permission when opening this file?

Others are hitting this as well in different repos. We have an offline conversation going about this. This seems to be Defender related.

@ericstj I'm not sure how to avoid the current failures. It looks like the vcxprojs use the net9.0-windows7.0 TFM but everything else just uses the net9.0 TFM. Any idea whether the vcxprojs need to use that TargetPlatformMoniker? Unsure if there's a better person to ask this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WPF VCXProj projects should build against the runtime version it references
2 participants