5

I have two Projects in my project folder:

  • HtSuite.UWP | Library
  • HtSuite.UWP.Leitstand | Applicaton

In the Library is an UserControl NamePasswordControl, which I can edit without any problems in the XAML | Designer.

enter image description here

When I place the NamePasswordControl on my LoginView.xaml (which is also in the Library), I got the following error:

the element "passwordView" could not be displayed due to missing assemblies. After building the application, you may be able to view this control

enter image description here

When I run the Application, everything is working as expected.

enter image description here

The following steps I tried so far (without success):

  • clean solution
  • rebuild project
  • deleted cache
  • dotnet clean
  • dotnet restore
  • restarted windows
  • updated VisualStudio (v16.6.0) and tried v16.7.0 preview 1

Anyone know how I can get the preview fixed?


minimal test project with same behavior:

https://files.dominic-jonas.de/stackoverflow/ClassLibrary2.zip

A class library in which there is a UserControl and a page on which should be displayed. However, the error is also displayed there and a preview is not possible


Log

  • 28.05.2020 Nico Zhu - MSFT could successfully load the preview of the TestProject (visual studio 2017 v15.9.17). I could not display the preview with vs2017.

Dominic Jonas
  • 4,717
  • 1
  • 34
  • 77
  • Have you tried to delete lib and app's bin and obj folder manually then rebuild the solution? – Nico Zhu May 27 '20 at 13:53
  • The problem still remains. In the `HtSuite.UWP.Leitstand` project, I can display the `UserControl` in the XAML designer without any problems. Only not within the `HtSuite.UWP` project where the `UserControl` is located. – Dominic Jonas May 27 '20 at 14:00
  • could try to remove the lib reference and re-add to the application(rebuild the lib before add to the application). – Nico Zhu May 27 '20 at 14:01
  • I uploaded a minimal test project where I have exactly the same behavior. Maybe you can have a look at it: https://files.dominic-jonas.de/stackoverflow/ClassLibrary2.zip – Dominic Jonas May 28 '20 at 10:05
  • Ok, I will check. – Nico Zhu May 28 '20 at 10:11
  • 1
    For my testing, if I build solution before open the xaml designer. `WindowsHelloControl` display well in the designer. – Nico Zhu May 28 '20 at 10:21
  • Agree with @NicoZhu-MSFT. Note: i'm opening VS in admin mode. BTW: Take a look at this thread: [Visual Studio refuses to build project due to missing assembly reference that isn't missing](https://stackoverflow.com/questions/29962432/visual-studio-refuses-to-build-project-due-to-missing-assembly-reference-that-is) – Maciej Los Jun 05 '20 at 08:49

2 Answers2

0

This issue is a bug of microsoft and was discussed in the developer community.

It was addressed to windows 10 and VS 2017 back at the time and it was said that the latest version fixed it already. It is possible that this problem reoccured in later version so you should post a ticket at the developer community as well.

Barr J
  • 10,636
  • 1
  • 28
  • 46
  • Thanks for your reply. I have alraedy posted on `MSDN` and `VisualStudio` Forum. But actually I did not get any response. – Dominic Jonas Jun 08 '20 at 06:31
0

Try these steps in order: (Before the steps, ensure you are using the latest visual studio version)

1-) Comment(or remove) all broken controls in your XAML view (in your case you should comment all <login:NamePasswordControl> tags and xmlns:login="..." reference) . The important point is: do not try to call any broken controls until the last step.

2-) Rebuild the solution. Then get the solution location(path) and close the Visual Studio.

3-) Go to the project location(path) and delete hidden ".vs" folder.

4-) Open and rebuild the solution.

5-) Uncomment(or write again) your controls in your xaml view again.

It worked for me. I hope it works for the people who encounter this issue too.