HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Opening included samples gives "Invalid Markup" in Visual Studio

15 May 2021, 18:20

Hi,

I'm trying to get more familiar with Blend and VS and how NoesisGUI works. I've been able to load some samples into my own application, and now want to pick at some of them and modify their XAML to understand things better.

When I open the XAML files from any of the 'ExampleName-blend' projects in VS, even after installing the right VS Installer-based package that gives me Blend, I can't actually see any preview of the GUI in order to make changes.

Is there a guide on how to set up VS from scratch to be able to do this, in case I've missed something?

Thanks!
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Opening included samples gives "Invalid Markup" in Visual Studio

17 May 2021, 10:36

Hi,

XAML Designer in Visual Studio will only work in a WPF/UWP project which includes the appropriate Windows assemblies. If you take a look at our SDK we provide specific Blend projects to edit XAML files, and we share the same files in our Noesis projects, so any modification made to those files will automatically be reflected in Noesis when you launch the application.

Are you using the C++ or C# SDK in your project?
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Opening included samples gives "Invalid Markup" in Visual Studio

21 May 2021, 17:17

Mysteriously, a bunch of the samples started working today. However, looking at Menu3D-blend in the VS solution that comes with the C++ SDK, I get the following errors when trying to look at MainWindow.xaml:
Severity	Code	Description	Project	File	Line	Suppression State
Error	XDG0008	The name "SettingsMenu" does not exist in the namespace "clr-namespace:Menu3D".	Menu3D-blend	C:\_Development\Repositories\rtg\third_party\Noesis\Src\Packages\Samples\Menu3D\Data\MainWindow.xaml	139	
Error	XDG0008	The name "MultiplierConverter" does not exist in the namespace "clr-namespace:Menu3D".	Menu3D-blend	C:\_Development\Repositories\rtg\third_party\Noesis\Src\Packages\Samples\Menu3D\Data\MainWindow.xaml	11	
Error	XDG0008	The name "MainMenu" does not exist in the namespace "clr-namespace:Menu3D".	Menu3D-blend	C:\_Development\Repositories\rtg\third_party\Noesis\Src\Packages\Samples\Menu3D\Data\MainWindow.xaml	137	
Error	XDG0008	The name "StartMenu" does not exist in the namespace "clr-namespace:Menu3D".	Menu3D-blend	C:\_Development\Repositories\rtg\third_party\Noesis\Src\Packages\Samples\Menu3D\Data\MainWindow.xaml	138	
After looking this up online, it seems like a common WPF+VS issue? People talk about trying to solve it by rebuilding/cleaning projects, but it doesn't look like the blend C# project can be cleaned or built. I've not modified the xaml or C#/C++ for this sample at all. Any ideas?
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Opening included samples gives "Invalid Markup" in Visual Studio

25 May 2021, 12:41

Have you built the Menu3D-blend project before opening MainWindow.xaml, so Visual Studio restored the required NuGet packages? It needs to do that to recognize our extensions and then compile the project classes correctly. After that it should show the xaml without errors if you opened it from the Blend solution (not from the C++ solution).

If after that you still have those errors it means for some reason the Visual Studio project cache is messed up. As other people mentioned online you can try to switch the .NET framework of the Blend project:
- Right click Menu3D-blend project, and select Properties
- Change "Target framework" to something else (4.8 for example)
- Build project again

Could you try that?
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Opening included samples gives "Invalid Markup" in Visual Studio

25 May 2021, 13:01

Have you built the Menu3D-blend project before opening MainWindow.xaml, so Visual Studio restored the required NuGet packages? It needs to do that to recognize our extensions and then compile the project classes correctly. After that it should show the xaml without errors if you opened it from the Blend solution (not from the C++ solution).
Is opening it from NoesisGUI-win-x86_64.sln not the right way?
If after that you still have those errors it means for some reason the Visual Studio project cache is messed up. As other people mentioned online you can try to switch the .NET framework of the Blend project:
- Right click Menu3D-blend project, and select Properties
- Change "Target framework" to something else (4.8 for example)
- Build project again

Could you try that?
Tried switching Menu3D-blend project properties to a different Target Framework, rebuild Menu3D (since Menu3D-blend has nothing to build - can't even clean/rebuild it), and the problem persisted.

I'm sure I'm missing something here.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Opening included samples gives "Invalid Markup" in Visual Studio

25 May 2021, 13:18

Is opening it from NoesisGUI-win-x86_64.sln not the right way?
Yes, but that solution contains 2 projects for each sample: the Blend project (suffixed by -blend), and the C++ project.
You need to expand the Menu3D-blend project and double-click MainWindow.xaml there to correctly edit the xaml in the designer.
since Menu3D-blend has nothing to build - can't even clean/rebuild it
The blend project contains all the C# and xaml files to run the corresponding WPF project, so I don't understand why you say there is nothing to build. Was Visual Studio able to load that project into the solution? Do you have ".NET desktop development" installed?
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Opening included samples gives "Invalid Markup" in Visual Studio

25 May 2021, 13:28

Yes, but that solution contains 2 projects for each sample: the Blend project (suffixed by -blend), and the C++ project.
You need to expand the Menu3D-blend project and double-click MainWindow.xaml there to correctly edit the xaml in the designer.
Ah yep, that's what I'm doing.
The blend project contains all the C# and xaml files to run the corresponding WPF project, so I don't understand why you say there is nothing to build. Was Visual Studio able to load that project into the solution? Do you have ".NET desktop development" installed?
If I right-click Menu3D-blend and hit 'rebuild', 'clean', etc, I just get:
Rebuild started...
1>------ Skipped Rebuild All: Project: Menu3D-blend ------
1> 
========== Rebuild All: 0 succeeded, 0 failed, 1 skipped ==========
It definitely loads into VS okay, and .NET Desktop Environment is installed. My VS is v16.8.3.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Opening included samples gives "Invalid Markup" in Visual Studio

25 May 2021, 13:42

You may have, at some point, removed the blend project from the solution build. Could you please check the solution "Configuration Manager" and verify if Menu3D-blend is selected for build in your active configuration and platform?
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Opening included samples gives "Invalid Markup" in Visual Studio

25 May 2021, 13:47

You may have, at some point, removed the blend project from the solution build. Could you please check the solution "Configuration Manager" and verify if Menu3D-blend is selected for build in your active configuration and platform?
I... have no explanation, but I opened the solution's "Configuration Manager", and then saw the previously-erroring .xaml designer preview switch to "Please build project", and I could build the *-blend projects. Now it all works.

How opening that window but touching _nothing_ changed this, I do not know. Time to add 'magic' to your help database I guess.

Thanks for your help!
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Opening included samples gives "Invalid Markup" in Visual Studio

25 May 2021, 13:55

Glad it finally worked, I don't know what could have happened to your Visual Studio solution.

Who is online

Users browsing this forum: Google [Bot] and 56 guests