Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile or run under sample projects, "Could not load file or assembly 'System.Runtime' and 'Class not registered'. #1439

Open
BradChase2011 opened this issue Jan 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@BradChase2011
Copy link

BradChase2011 commented Jan 12, 2024

Describe the bug
Setting up simple UWP or console apps from the given VS templates cannot use CsWinRT. When trying to compile said apps, this error occurs:

Microsoft.AppXPackage.Targets(1437,5): error MSB3816: Loading assembly "C:\User.nuget\packages\microsoft.windows.cswinrt\2.0.4\lib\net6.0\WinRT.Runtime.dll" failed. System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

A certain console app, in the given example, project "ConsoleApplication2" can run but stops immediately after the first call to the class with error:

Exception thrown at 0x00007FFB14B8567C (KernelBase.dll) in ConsoleApplication2.exe: WinRT originate error - 0x80040154 : 'Class not registered'.
Exception thrown at 0x00007FFB14B8567C in ConsoleApplication2.exe: Microsoft C++ exception: winrt::hresult_class_not_registered at memory location 0x0000009439D2F058.
Unhandled exception at 0x00007FFB14B8567C in ConsoleApplication2.exe: Microsoft C++ exception: winrt::hresult_class_not_registered at memory location 0x0000009439D2F058.

To Reproduce
Download the git repository and try to compile each project. For the console app, run it once and let it error out on the immediate call to the AuthoringDemo class library.

https://github.com/BradChase2011/BrokenSampleCsWinRT.git

The solution file is src\BlankApp1\BlankApp1.sln

Expected behavior
Expect the apps to compile and be able to use the given CsWinRT class.

Version Info
WORKS ON CsWinRT 1.5.0.
BROKEN on everything after 1.5.0.
CURRENTLY set up on 2.0.4.

Additional context
Again they compile and run on 1.5.0 but not above. Just download the git and try to compile to see errors.

@BradChase2011 BradChase2011 added the bug Something isn't working label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant