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

WinUI in VS 2019 Preview gives error "... requires WinRT.Runtime.dll version 1.2 or greater" and more #4894

Closed
tedekeroth opened this issue Apr 25, 2021 · 18 comments
Labels
area-Tooling product-winui3 WinUI 3 issues team-Markup Issue for the Markup team v0.5 Issues introduced in the Project Reunion 0.5 prerelease

Comments

@tedekeroth
Copy link

Describe the bug
Unable to build "Blank App, Packaged (WinUI 3 in Desktop)". The error list contains:

This version of Project Reunion requires WinRT.Runtime.dll version 1.2 or greater.
Please update to .NET 5.0.6 SDK or later. Or add a temporary Microsoft.Windows.SDK.NET.Ref FrameworkReference of version > 10.0.*.16 or later.

I also note that I have yellow triangles in the Dependencies regarding the WinUI, see below.

Steps to reproduce the bug

  1. I installed the VS 2019 Preview from microsofts webpage, version is Version 16.10.0 Preview 2.1
  2. I followed the instructions here: https://docs.microsoft.com/en-us/windows/apps/project-reunion/get-started-with-project-reunion#set-up-your-development-environment and here https://docs.microsoft.com/en-us/windows/apps/winui/winui3/get-started-winui3-for-desktop to setup Reunion
  3. Open VS2019 Preview, create new Project ""Blank App, Packaged (WinUI 3 in Desktop)"
  4. Build

Expected behavior
I expected the app to build and run, with no apparent errors.

What happened instead
In step 5 here: https://docs.microsoft.com/en-us/windows/apps/winui/winui3/get-started-winui3-for-desktop, after clicking OK, I get this error message:
image

After clicking OK in that error popup, the project loads, and I can see errors in the dependencies:
image

I also note that the "Windows Application Packaging Project" that is supposed to be created (according to the URL above), is not created.

Version Info
WinUI packages version: 0.5.5
Windows app type: desktop
OS: Win 10 20H2 build 19042.928

NuGet package version:
See above.

Windows app type:
Ehm, I am not sure. It says "Output type: Window Application", so I guess Win32?

UWP Win32
? Yes
Windows 10 version Saw the problem?
October 2020 Update (19042) Yes
Device form factor Saw the problem?
Desktop Yes

Additional context
I have used the maui-check tool, and that says that everything is OK:

image

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Apr 25, 2021
@tedekeroth
Copy link
Author

I just noticed this thread, which reports the same problem:

microsoft/WindowsAppSDK#740

I didnt see it at first, as I was directed to https://github.com/microsoft/microsoft-ui-xaml for any WinUI bugs found. This bug report is in https://github.com/microsoft/ProjectReunion.

Thanks.

@asklar
Copy link
Member

asklar commented Apr 26, 2021

Duplicate of microsoft/WindowsAppSDK#740

@asklar
Copy link
Member

asklar commented Apr 26, 2021

Workaround is to add a global.json in the solution folder:

{
"sdk": {
"version": "5.0.202"
}
}

@tedekeroth
Copy link
Author

tedekeroth commented Apr 27, 2021

Hello, I tried that, and yes, the errors did disappear, but it wont start anyways. Perhaps a new ticket is required, but the error when running it in debug is:

System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'
Inner Exception:
COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))

And I found this issue:
#4537

Where there isnt a fix really, just a workaround

@asklar
Copy link
Member

asklar commented Apr 27, 2021

@tedekeroth you have to create the global.json file first, then create the project (which should create 2 projects). If you create the global.json file after you get that error, only the app project will have been created, not the packaging project which is the one you want to run, which is probably why you're hitting the error.

@asklar
Copy link
Member

asklar commented Apr 27, 2021

in other words: delete the projects that were created, ensure you have an empty folder, add the global.json, then create the solution in that folder which should create 2 projects in that solution.

@tedekeroth
Copy link
Author

You suggest that add the global.json to a folder, then create a solution (.sln) inside that same folder, and then on top of that add the projects? I will try that and report back!

@asklar
Copy link
Member

asklar commented Apr 27, 2021

yes, those are the steps that worked for me

@tedekeroth
Copy link
Author

tedekeroth commented Apr 27, 2021

Alright, that worked in the sense that the Package project was created correctly. I then added the ItemGroup in csproj. It then builds, and looks ok, even though it fails in runtime as stated above.

You write that "which is the one you want to run, which is probably why you're hitting the error", indicating I want to run the package project? I read elsewhere that it is not the package project that should be started, but the app project?

@asklar
Copy link
Member

asklar commented Apr 27, 2021

yes, the package project is the one to start, can you try that?

@tedekeroth
Copy link
Author

Yes, that worked. I was very confused from this thread here, where I thought they said that it is not the package project that should be started:

As a sanity check, the app being debugged doesn't have "Package" in the name, which is the default for packaging projects (e.g. "ETIHub.TDHub.Demo.UI (Package)" instead of "ETIHub.TDHub.Demo.UI"). @s3nt1n3l-hub can you confirm the wapproj/packaging project is being run instead of the unpackaged application?

That sounded to me that Packaging shouldn't be run. Apparently, I misread of they said the wrong thing.

Thanks for your input asklar =)

@StephenLPeters StephenLPeters added area-Tooling v0.5 Issues introduced in the Project Reunion 0.5 prerelease team-Markup Issue for the Markup team product-winui3 WinUI 3 issues needs-triage Issue needs to be triaged by the area owners and removed needs-triage Issue needs to be triaged by the area owners labels Apr 28, 2021
@StephenLPeters
Copy link
Contributor

@alwu-msft FYI

@AghaKhan
Copy link

AghaKhan commented Apr 29, 2021

Today I tried to build simple application with WinUI, but it failed.
version

I tried everything as suggested, but it didn't work. Maybe due to change version 0.5.5 to 0.5.6

@codendone
Copy link
Contributor

@AghaKhan Did you try the option of adding this block in your .csproj file?

<ItemGroup>
    <FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" RuntimeFrameworkVersion="10.0.18362.16" />
    <FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" TargetingPackVersion="10.0.18362.16" />
</ItemGroup>

@AghaKhan
Copy link

AghaKhan commented Apr 30, 2021 via email

@bluephoton
Copy link

@codendone solution worked for me, shame this WinUI3 desktop template is still broken out of the box as of today 6/5/21, not sure why this is closed!

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Jun 6, 2021
@akilarajesh1313 akilarajesh1313 removed the needs-triage Issue needs to be triaged by the area owners label Sep 20, 2021
@rafalkubiak
Copy link

I didn't code WinUI for some time (I tried it some time ago and worked perfectly fine) and now I wanted to take a tour and surprisingly have the same error but in other version of WinRT.Runtime.dll (this time is 1.6). Can somebody tell me what to do?

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Apr 10, 2022
@AghaKhan
Copy link

Today in response to message today I tried to build Microsoft provided code (DemoBuildCpp) which compiled ok but got run time exception
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Tooling product-winui3 WinUI 3 issues team-Markup Issue for the Markup team v0.5 Issues introduced in the Project Reunion 0.5 prerelease
Projects
None yet
Development

No branches or pull requests

10 participants