XamlC error after upgrading Visual Studio / SDK 6.0.2
See original GitHub issueAfter updating Visual Studio / SDK 6.0.2, I am seeing the following Xaml compiler errors in my WPF App:
XamlC error XFC0000 : Cannot resolve type "Application"
XamlC error XFC0000 : Cannot resolve type "Window".
I have isolated the cause of these errors to a package reference that references ‘Xamarin.Forms’. This package reference worked fine prior to installing the update.
Repro Steps
- Create a new WPF App.
- Add a package reference to ‘Xamarin.Forms’.
- XAML compiler can not resolve “Application” and “Window” types.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
NETSDK1045: The current .NET SDK does not support ...
Go to Tools > Options > Environment > Preview Features, and make sure that Use previews of the .NET Core SDK is checked....
Read more >Visual Studio 2022 problem after upgrade to last version ...
This issue is caused not by the Visual Studio update from 17.2.5 to 17.2.6, but by the update from .NET SDK 6.0.301 to...
Read more >Solution to Visual Studio 2022 messing up ...
The error shown when attempting to load the projects was: The project file cannot be opened. Unable to locate the .NET SDK. Check...
Read more >Unable to locate the .NET SDK: The Reasons - Hamid Mosalla
In this post is about fixing the following error : "The project file cannot be opened. Unable to locate the .NET SDK" we'll...
Read more >Error after upgrading to latest version of Visual Studio 2022 ...
[Solved]-Error after upgrading to latest version of Visual Studio 2022 and project is not being loaded-.net-core. Search. score:0. Download .NET SDK (6.0) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ebussa This looks unrelated to WPF because the XAML files in your repro are WPF XAML files but the error says that Xamarin tries to compile the files (Which it can’t, hence the errors). So it looks like the Visual Studio update made Xamarin try to compile those WPF XAML files (Xamarin tries to compile every .xaml files by default). You can opt out of the default Xamarin compilation by setting EnableDefaultXamlItems to false in your csproj.
The point that I was trying to make in my previous comment wasn’t that you shouldn’t do it, it was that it wasn’t suppose to work in the first place. By default, WPF and Xamarin will both try to compile .xaml files so you need to disable the one that you don’t use in your project.
Thank you for that, it works!
I will create an issue with the third party package team and let them know about this change.