WinUI 3 xaml ABI.Microsoft.UI vs Microsoft.UI - c#

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 ...

Related

VS 2022 WPF Invalid Markup

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.

'System.Exception' thrown in new Xamarin.Forms project

I've installed a fresh copy of Visual Studio 2017 Community Edition on Windows 10 Pro Fall Creators Update recently, and I'm unable to properly create a new ContentPage on Xamarin.Forms (see screenshots 1-3). At my first attempt of creating a new ContentPage in a new Xamarin.Forms project, I encountered the errors seen on screenshot 1 and 2.
Next, an automated error log was generated (as attached). If I don't create any new items and run as-is, I can successfully launch the app on my Android emulator with no issues.
Exception of type 'System.Exception' was thrown
The project system has encountered an error.
Did not find new element in the hierarchy for item "Page2.xaml". The
item would have been added with type "Page". The project item
schema service knows about this item type. The item does exist
in the project file.
A diagnostic log has been written to the following location: "C:\..." (see below link)
Automatically generated error log file - txt
The issues arise when I create a new ContentPage. The code-behind .cs file and .xaml file will not be immediately visible in the Solution Explorer. I need to manually click the Show All Files button to show the newly created files (as seen in screenshot 3). However, I couldn't include them into project despite multiple tries.
When I open a .xaml file (in this case Page2.xaml), errors mentioning missing references and assemblies are visible (see screenshot 4 below).
I've done the following thus far:
Removed mobile app development (Xamarin) in the Visual Studio
installer
Reinstalled Xamarin by including (checking) the mobile app
development (Xamarin) in the Visual Studio installer
Are there any known solutions to this issue? Any assistance is kindly appreciated. Thanks!
UPDATE (Feb 27): Attempted recommendation by Paul-Jan but the issues still persist. However, the newly created Page1.xaml was properly included and recognized by Solution Explorer (as shown below).
I've had this happen with fresh VS2017 Professional installs where Universal Windows Platform (UWP) support was not added during install. Of course you might have no desire at all to develop for UWP, but apparently there are bits and pieces of the Xamarin Forms toolchain missing when you don't install it.
Running the Visual Studio Installer again, adding UWP support, helps.

cannot add cefsharp to wpf

I installed cefsharp using nuget
and followed the tutorial on the link below
https://www.codeproject.com/Articles/881315/Display-HTML-in-WPF-and-CefSharp-Tutorial-Part
but i can't make it work.
currently im using .net framework 4.5.2
i also build the program. i can also run the program, but it doesn't show the webbrowser.
i also add the namespace: xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
the screenshot of the error is below
This error only occurs when you have opened Visual Studio WPF designer (wiki CefSharp). When you run program everything will be ok.
it seems you didn't added referecnces to your project, first add references and then include them into your code.

No symbols have been loaded for this document VS2015

I have seen several posts regarding this same issue. None have solved my problem. I have recently downloaded VS2015, I had been using VS2012. I open the same project in both, 2015 does not load the symbols and 2012 does. If I open it in 2012 and build it, then open it in 2015 it will load the symbols until I rebuild it. Anyone have any ideas?
One other thing that I thought interesting. I have a Winforms app that I did the exact same process with and the Winforms app works great
This was a bug with Telerik Data Access. They stopped supporting their visual designer. In order to fix the issue you have to get the updated Data Access from a NuGet package Telerik.DataAccess
The installation of the new data access should give you the Q2 2015 DLLs. It will also add a packages file to your project. You also need to open that and change the line
<UseXmlMapping Condition="'$(UseXmlMapping)'==''">false</UseXmlMapping>
to
<UseXmlMapping Condition="'$(UseXmlMapping)'==''">true</UseXmlMapping>
And also add the following code at the end of your property groups and before item groups
<PropertyGroup>
<UseXmlMapping>true</UseXmlMapping>
</PropertyGroup>

No WPF User Control Library Template found in VS 2013

I am using VS 2013 (Express Version) and I want to create a WPF user Control Library project. But I am not able to find the template in my installed templates list. If I use Winforms, I am able to build a DLL out of my Winforms Application Project just by changing the Output type as "Class Library". But it is not happening in WPF and it is throwing errors if I do so. Is this the correct method of doing it or am I going wrong?
And in the Create New Project dialogue window, I am not able to find the .NET Framework selector drop down. After creating the project only I am able to change the .NET framework version by going inside the properties of the project.
Kindly help me to get out of this. Thanks in advance.
I have been working on this exact same problem for hours this morning. Here is what I think I have learned:
With Visual Studio Express 2013, it is by design that the WPF User Control Library template is not available for making a New Project. This is because it is the free Express version.
With the Express version, you don't have a "devenv.exe" for trying the "devenv /installvstemplates" to "fix" things. It is, instead, called (just a moment while I look this up again...) "WDExpress.exe" and will be located (if you have default location) in the "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" directory. BUT - this won't help you. It won't fix your problem, because, as I mentioned, your Express installation is designed to not have that template available for New Project, so your "fix" won't put it there. I know this because this is what I tried myself. (Also, note that the instructions for doing this tell you to uninstall any extensions you've installed before doing it. And then, of course, if you still want them you have to reinstall them. Like I still have to do, incidentally.) I'm letting you know all of this so you don't go through the headache I'm having.
Note that I have not done this yet, so this is somewhat hypothetical on my part, but is based on my research on the Internet so far - Your solution is to create a WPF User Control Library manually [but now see UPDATE below]. (No, I don't know how to do this yet. I got into this in the first place, because I'm a WPF novice - just started working with it a few days ago - and late last night I got this great idea to add a "spinner" progress indicator to my "WPF play/learning project" I'm working on, and found a couple of relatively easy-to-work-with samples on the Internet - both of them are a WPF User Control Library - and at first I wanted to use the copy-and-paste to put the code in. But then I discovered... well, our mutual problem, because I'm using Visual Studio Express 2013. No such template under New Project. And literally at the tail end of my about-to-throw-in-the-towel, I'm googling and your post, Dhivakar, is already showing up with the right Google search.) So I haven't finished my research yet, but my next step is to learn exactly how to create a WPF User Control Library manually (the code and various project property settings), and then I can just save a WPF User Control Library skeleton for future use and document the details.
UPDATE: This guy totally has the solution for Express versions. I have followed his steps and it works great. The only additional piece of information I would add is that in my version (VSE2013), after you've created your WPF User Control Library template, when you open Visual Studio again and use File -> New Project, my selection in the tree (for a Windows app) came up under Templates -> Visual C# -> Windows (which is what I've been using). I did not see my template showing up there, after I created it, and I thought, "Great! Another piece of advice that doesn't work." But then I clicked up one on the "Visual C#" parent - and there was the template!
Here you go:
How to add a WPF control library template to Visual C# Express 2008
https://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/
Yes, it works this way for VSE2013 too.
UPDATE 2: I'm not absolutely positive about this, but I think he missed one little piece. In his step #4 he says to delete Window1.xaml and App.xaml. Maybe this didn't apply with VSE 2008, but in VSE 2013 there is also the App.config file which I believe is extraneous for our purpose. So you can delete App.config as well. As I said, I'm not absolutely certain about this yet, but I noticed that file in the project when I added a WPF User Control Library project to my solution, and I deleted it, and the solution compiled okay.
Try running devenv with the /installvstemplates switch, from https://msdn.microsoft.com/en-us/library/vstudio/ms247116(v=vs.100).aspx
If this doesn't work, browse to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp\WPF\1033\WPFUserControl (this could change dependent upon your installation directory), open the .vstemplate file in a text editor, and make sure the setting is set to true, then try running devenv with the switch again.
Hope it helps.

Categories