microsoft / WindowsAppSDK-Samples

Feature samples for the Windows App SDK
MIT License
677 stars 218 forks source link

Project references not resloved in a WinUI 3 C++ project #252

Open Ruyi-Wonton opened 1 year ago

Ruyi-Wonton commented 1 year ago

In the project PhotoEditor, why is there exclamation mark in the Reference, prompting "..... references could not be resolved"

The steps to reproduce are as follows

  1. Download this sample https://github.com/microsoft/WindowsAppSDK-Samples.git.
  2. Open WindowsAppSDK-Samples/Samples/PhotoEditor/cpp-winui/PhotoEditor.sln , then the references may be empty.
  3. Rebuild the project, close PhotoEditor.sln, and then reopen it.
  4. Check the references, you will find exclamation mark prompt.
  5. But if you choose the Microsoft.WindowsAppSDK version to 1.0.4, there is no exclamation mark.

My Visual Studio version:Visual Studio Community 2022 17.3.4.

This question comes from Microsoft Q&A (Project references in a WinUI 3 C++ project) and I would like to know how this problem can be solved.

InkedMicrosoftTeams-image (2)_LI

Scottj1s commented 1 year ago

The given references are being added via Microsoft.WindowsAppSDK.1.1.0\build\native\WindowsAppSDK-Nuget-Native.WinRt.props.

Attempted fixes included:

No change was observed with either (or both) of these fixes

As an experiment, moving the references into the vcxproj, with absolute paths, resolved the issue. So this issues is unique to transitive references in referenced packages.

Design time logs attached, created via env vars: set TRACEDESIGNTIME=true set _REFERENCE_DEBUG=true

DesignTimeLogs.zip

Note that minimal repro doesn't require a build, just a nuget restore