dotnet / dotnet/wpf

UseWpf magically set to true in VS 17.9

Open
#8,935 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

This is a follow-up of issue https://github.com/NuGet/Home/issues/13292

UseWpf is magically set to true when restoring one of our projects, only in Visual Studio (no problem using the command line, UseWpf actually not set for this project).

### Reproduction Steps

- See https://github.com/NuGet/Home/issues/13292 issue for more context
- Unfortunately, will be almost impossible to share binlogs because of compliance security restrictions.

Steps:
- Compile the repo with the command line
- Open a solution filter containing only GUI projects, with the top-level main project set as startup project (others are actually libs containing GUI components)
- Run the solution (F5)

### Expected behavior

Nothing to rebuild, the main GUI application should start (almost) immediately.

### Actual behavior

All GUI projects get restored (and rebuilt) again...

### Regression?

Can't say, I upgraded to VS 17.9 when we started targeting net6.0-windows in our GUI projects.

### Known Workarounds

- Explicitly set property `false` in our Gui.Core project.
- Use Ctrl-F5 to bypass build.

### Impact

- Visual Studio keeps restoring projects in the background.
- Many minutes lost every time I need to start my application.

### Configuration

- VS 17.9.4 + dotnet --version 8.0.202
- Same problem with VS 17.9.2 and dotnet 8.0.200

### Other information

- UseWpf is explicitly true for only one UT project Gui.Tests (not loaded in the solution).
- All GUI projects target frameworks `net48;net6.0-windows`
- VS binlogs show that `UseWpf` is unexpectedly true:
- Only for Gui.Core project
- In CentralNode_devenv_*_Default.binlog:
- `UseWpf=true` when calling targets `GetTargetFrameworks > GetTargetFrameworksWithPlatformForSingleTargetFramework` in `net6.0-windows`
- In this target, after `GlobalProperties`, I see almost all properties listed, even _Internal ones.
- Strangely, the same target is called for `net48` but I don't have the list of all properties, I only have the `GlobalProperties`
- For other projects, with `net6.0-windows`, I have only `GlobalProperties` node
- `UseWpf=true` also for `DispatchToinnerBuilds > Build` target, only in `net6.0-windows`, with the same pattern (all properties listed after `GlobalProperties` node)
- 3rd & last occurrence for these targets `ResolveProjectReferences > GetNativeManifest`
- In CentralNode_devenv_*_DesignTimeBatchBuild.binlog:
- `UseWpf=true` when calling `GenerateSupportedTargetFrameworkAlias`
- Here, no list with all properties, only the 5 parameters, in particular `UseWpf=true` (unexpected) and `UseWindowsForms=true` (expected)
- Cannot find `UseWpf` in the binlog of `dotnet restore /bl` in the command line.
- Impacts in `project.assets.json` where `frameworkReferences = "Microsoft.WindowsDesktop.App"` in Gui.Core and also in the project.assets.json for the reference to this project for all projects depending on it (directly or not) (should have been `Microsoft.WindowsDesktop.App.Windows`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.