Share via

New WinUI 3 projects fail to build with CS1061 errors after a fresh OS and VS install.

glen burke 0 Reputation points
2025-07-25T07:55:50.1866667+00:00

The error always appears in the generated file MainWindow.g.cs. This indicates that the XAML compiler is not correctly connecting the UI file to the code-behind file.

Troubleshooting Steps Already Taken:

I have already performed extensive troubleshooting, including:

Rebuilding the solution multiple times.

Cleaning the solution and manually deleting the bin, obj, and .vs folders.

Running dotnet restore from the Developer PowerShell.

Running the "Repair" feature from the Visual Studio Installer.

Performing a full factory reset of Windows and a fresh install.

After the factory reset, performing a fresh install of Visual Studio 2022 Community and also Visual Studio 2022 Preview.

During the installation, I selected the following workloads:

.NET desktop development

  Universal Windows Platform development
  
     Desktop development with C++
     
        WinUI application development
        

The error persists even after a complete OS and Visual Studio reinstall, on both the stable and preview versions of Visual Studio. This seems to be a fundamental issue with the build tools or the SDK installation on my machine.

Any help would be greatly appreciated. Thank you.

Developer technologies | Visual Studio | Setup

1 answer

Sort by: Most helpful
  1. Surya Amrutha Vaishnavi Lanka (INFOSYS LIMITED) 2,285 Reputation points Microsoft External Staff
    2025-08-25T09:43:31.8366667+00:00

    We haven’t received any further updates or follow-up on this case, so we’ll proceed with closing it at this time. If you require additional assistance or have new information to share, please feel free to raise new thread, we’re happy to support you further needed.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.