(Solved) False build errors in VS 2022, WPF C#

Svatopluk Černý 20 Reputation points
2024-07-09T08:17:41.4266667+00:00

I'm working on a C# WPF music player in VS. I opened the project after a short break but with 17 build errors that weren't there before. I can normally build, run, use the running program. Everything included in the errors that is interactive works perfectly fine. The errors are all CS0103 (names: "PositionSlider" "PositionTextBlock" "SongTitleTextBlock" and more). It is not caused by code, I'm sure because everything programmed works and it doesn't show these errors in a new project with the same code. Already tried restarting Visual Studio, cleaning and rebuilding the solution etc..

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,220 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 29,926 Reputation points Microsoft Vendor
    2024-07-09T13:40:33.9033333+00:00

    Hi @Svatopluk Černý,

    Welcome to Microsoft Q&A! 

    It seems be a known issue:

    Second time reporting: WPF: C# Editor cannot find controls defined in xaml file and shows every control reference as error. But project compiles ... - Developer Community (visualstudio.com) 

    As others suggested, you can close all running VS instances and manually delete the hidden .vs, bin and obj folders in the project folder.

    Then, rebuild the solution. 

    You can also vote on that ticket and add your comment to follow the progress. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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