Microsoft.Toolkit.Win32 icon indicating copy to clipboard operation
Microsoft.Toolkit.Win32 copied to clipboard

[Warning] The referenced component '..\uap10.0\Microsoft.Toolkit.Win32.UI.XamlHost.winmd' could not be found

Open sbanni opened this issue 6 years ago • 12 comments

  1. Create a C# WPF Core application and make sure package references are enabled.

  2. Use the NuGet Package Manager window to install package "Microsoft.Toolkit.Wpf.UI.Controls", version is v6.0.0 or later.

  3. Configure the target from "any cpu" to "x64".

  4. Add a UWP project to the same solution, make sure the target version and minimum version are both set to "Win10 version 1903" or later.

  5. Use the NuGet Package Manager window to install package "Microsoft.Toolkit.Win32.UI.XamlApplication", version is v6.0.0 or later.

  6. Replace the content of app.xaml with the following code, make sure to replace MyUWPApp with your UWP project name.

<xaml:XamlApplication x:Class="MyUWPApp.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xaml="using:Microsoft.Toolkit.Win32.UI.XamlHost" xmlns:local="using:MyUWPApp"> </xaml:XamlApplication>

  1. Replace the content of app.xaml.cs with the following code, make sure to replace MyUWPApp with your UWP project name.

namespace MyUWPApp { sealed partial class App : Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication { public App() { this.Initialize(); } } }

  1. Delete the MainPage.xaml from the UWP project.

  2. Build the UWP project.

  3. In your wpf project, right click the Dependecies node and add a reference to your UWP project. (you will enter bug 1054800)

  4. Closed your solution, and re - open it.

  5. Open the MainWindow.xaml under the WPF Core project.

  6. Add the control InkCanvas from the toolbox.

  7. Expand references node in UWP project

The file in the warning does exist on disk:

c:\Users\username.nuget\packages\microsoft.toolkit.win32.ui.xamlapplication\6.0.0\lib\uap10.0>dir

Volume in drive C is OSDisk

Volume Serial Number is BE31-803E

Directory of c:\Users\username.nuget\packages\microsoft.toolkit.win32.ui.xamlapplication\6.0.0\lib\uap10.0

01/13/2020 05:21 PM <DIR> .

01/13/2020 05:21 PM <DIR> ..

11/13/2019 01:53 AM 11,808 Microsoft.Toolkit.Win32.UI.XamlHost.winmd

11/13/2019 01:50 AM 133 Microsoft.Toolkit.Win32.UI.XamlHost.xml

           2 File(s)         11,941 bytes

           2 Dir(s)  47,696,236,544 bytes free

sbanni avatar Mar 06 '20 20:03 sbanni

Hello sbanni, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar Mar 06 '20 20:03 ghost

@marb2000

michael-hawker avatar Mar 11 '20 20:03 michael-hawker

@sbanni does this cause build errors or it's just a warning?

marb2000 avatar Mar 11 '20 21:03 marb2000

Same issue today trying to test https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/host-custom-control-with-xaml-islands

Severity Code Description Project File Line Suppression State Warning The referenced component 'C:\Users\username.nuget\packages\microsoft.toolkit.win32.ui.xamlapplication\6.0.1\build..\lib\uap10.0\Microsoft.Toolkit.Win32.UI.XamlHost.winmd' could not be found. App1

It's a warning, but Publish I get "An error has occured".

10.05.2020 11:38:50 System.AggregateException: One or more errors occurred. ---> System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. --- End of inner exception stack trace --- ---> (Inner Exception #0) System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---

System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.

===================

rmoergeli avatar May 10 '20 09:05 rmoergeli

I have the same issue.

hansmbakker avatar Jul 18 '20 20:07 hansmbakker

I repro it today and there is still this warning in the 6.1.1 update:

Severity	Code	Description	Project	File	Line	Suppression State
Warning		The referenced component 'C:\Users\xxx\.nuget\packages\microsoft.toolkit.win32.ui.xamlapplication\6.1.1\build\..\lib\uap10.0\Microsoft.Toolkit.Win32.UI.XamlHost.winmd' could not be found.	UWPApplication	

@ocalvo, can you take a look?

marb2000 avatar Aug 09 '20 06:08 marb2000

The same warning is still in Version 6.1.2, but I was able to publish with a self-signed cert, targeting x64, without errors.

mentorfloat avatar Aug 22 '20 07:08 mentorfloat

When I remove this entry from the references list the warning goes away and the program compiles and runs without error. Unfortunately at every restart of visual studio the reference comes back. Is this perhaps a VS issue and not an issue with the toolkit at all?

DuncanStone avatar Jan 14 '21 19:01 DuncanStone

Any word on this? I am getting sick of having to delete this reference multiple times a day and I don't like to just ignore warnings

DuncanStone avatar Jan 19 '21 20:01 DuncanStone

@marb2000 @ocalvo any updates?

michael-hawker avatar Jan 19 '21 21:01 michael-hawker

@marb2000 @ocalvo any updates, this is still a problem.

Samuel12321 avatar Nov 07 '21 06:11 Samuel12321

Same problem, 2023.

LunevNF avatar Aug 01 '23 05:08 LunevNF