VS 2022 WPF Invalid Markup - c#

i have a problem when using VS 2022 (Version 17.3.6).
I created a WPF application (.net 6.0) using dotnet-cli a while ago and developed with vs code.
Everything works fine with vs code.
Now someone wanted to build with visual studio, created a project solution and opened it.
If i click build/debug i get 603 errors... but it still builds and runs it :D
I could live with this but the Designer won`t show anything except "Invalid Markup" (because of the 603 Errors).
You can see here that the errors are not understanable for me. Title, Height and Width are valid Properties of the Class Window.
Also Bindings and Styles throw an Error
You can find the Project at Github
I really hope someone know the answer and can help me.
I also tried copy everything into a new created project with vs 2022 but the problem is still there.
Tried on different computers also a completly new installed windows vm.

Related

Timed Out, Error when loading Form Design on Visual Studio

I am running Visual Studio on a Windows 11 VM with Parallels on an M1 Mac. Visual studio works perfectly when creating a new project but when I try to open an already created project with a different .Net Framework version than 4.7.2, I cannot open the Designer for the forms in the project.
I tried changing it to 4.7.2 from properties and manually changing in .csproj but this will generate other errors and eventually cause problems to other people opening the project (as it is shared with GIT).
Running the project will not cause problems, the app builds perfectly.
How could I try to solve this problem?
The full error is: Timed out while connecting to named pipe.
Thank you.

WinUI 3 xaml ABI.Microsoft.UI vs Microsoft.UI

I'm trying to use WinUI (3) for the first time.
I've followed the instructions at https://learn.microsoft.com/en-us/windows/apps/winui/winui3/#install-winui-3-preview-4 so installed vs 2019 preview (Professional Version 16.9.0 Preview 4.0) and installed the "WinUI 3 Project Templates via the Manage Extensions option.
Created a new solution, added project type "Blank app, Packaged (WinUI in desktop)" (C#) and this is the result:
I can start debugging and the window opens and can click the example button without any issues.
But when I open the xaml I have this issue:
And the intellisense doesn't give options like for example grid.
The imported namespaces in the code behind:
So all the basics of a new WINUI project on a clean vs 2019 preview installation. I've only installed Resharper and imported my settings from my regular vs 2019 installation (which I reset but to no avail).
When I choose for Microsoft.UI.Xaml.Window he changes the xaml to
And gives following errors:
When choosing ABI.Microsoft.UI.Xaml.Window the xaml changes in the same way as before but also gives exceptions on other properties like "The property 'HorizontalAlignment' was not found in type 'StackPanel'".
No idea if this matters but as I've never worked with WPF I don't have experience with xaml (always worked with winforms as frontend). So I also added a WPF project to this solution and this worked without any issue.
I can't find anything regarding this so please help me set my first steps in WINUI.
I've notificed it worked for a few seconds after reopening my solution. So prime suspect was Resharper. Disabled it, and problem is solved. Re-enabled it, updated to 2020.3.2 and it worked.
So lesson here: It's not because you just installed Resharper, that it also downloads the latest version ...

Setting Thread.CurrentThread.CurrentUICulture suddenly seems to have no effect for me

We have a C# Click-Once application that uses Windows Forms (Yes, I know that is old, we will be creating a new application with Xamarin soon). There are a few of us, each developing in Visual Studio 2017. We share our code via TFS. I have all the latest Visual Studio updates installed and have compared my visual studio version, 15.2 (26430.16) with my co-workers. We have the same version.
Anyway, Our application is multi-user, users log in with separate accounts and we set the display language based on user-preferences, not the machine's current language. We set it using this line:
Thread.CurrentThread.CurrentUICulture = OurFormClass.UserPreferredCultureInfo;
OurFormClass.UserPreferredCultureInfo is a static method that returns our user's preferred language in a CultureInfo object.
We have been doing this for years however a few days ago I noticed that it no longer works for me. Strangely, it still works for the rest of our developers. When I log in as one of our foreign-language test-users all of my label controls and string resources are still in English. I have set a breakpoint at the above line and it is getting set to the correct language however there is no effect.
I have tried deleting my source code and pulling it back down from source control. This did not help. I even tried uninstalling and re-installing Visual Studio. This still did not help. I copied my build output to a network drive and had one of my co-workers run it. Everything was English. I had him copy his build output to the network drive and I ran it. Internationalization worked!
I really don't know what to even try from here. I am using known-good source code and a fresh install of Visual Studio. Does anyone have any ideas where I should look next?
Thanks for any help!

Cant load or create projects VS 2015.1. Visual c# 2015 Compiler could not be created

Visual c# 2015 Compiler could not be created. Please re-install Visual Studio.
First of all with my vs 2015 everything was ok. But after update 1, uwp designer wont start. So i uninstalled my windows 10 sdk tools, and reinstalled vs, but now in project templates i cant see uwp apps (but i have 8.1 apps) and when im trying to create any project i got errors (of compiler).
I tried many things to fix my VS but nothing helps, even /Uninstall /Force and reinstalling.
Please help me ! :(
I had the exact problem too mate, but mine was for the creation of a VB console app (couldnt create a compiler).
What I did and fortunately worked, was to go to control panel, go to uninstall the Visual Studio and right click on it and click on 'Change' (this was the only provided option). Then a window appeared and gave me three options, one of which was to 'Repair'.
Choosing repair and letting the program do its thing should fix the problem, at least it did for me.

New WPF Project Won't Compile -- Throws Error "The name 'InitializeComponent' does not exist in the current context"

I'm getting started with WPF, but when I create a new WPF project (usuing all default options) it won't compile after VS generates the project. (Both under C# and VB) I believe I'm running the latest/greatest VS (which is maybe the problem?)
Microsoft Visual Studio Premium 2012
Version 11.0.60610.01 Update 3
Best I could tell none of the answers here provided any help at all. The namespaces/class names are all correct.
Did you change a file name at any point?
Try Rebuild (not Build).
Uninstalled the .Net frameworks and reinstalled them and everything works again! BTW, tried reinstalling VS and that had no effect, don't waste your time.
However, very shortly after this I ran into this problem:
Error Reading Resource File for any WPF Project in VS2012
However, it worked briefly before the problem started, so I'm not sure if this solution had anything to do with the new problem or not. Just be aware.

Categories