try-convert icon indicating copy to clipboard operation
try-convert copied to clipboard

WinUI Enhancements

Open MadEste opened this issue 3 years ago • 8 comments

WinUI3 Conversion To Do

This is specific to the feature/winui branch. #306 There are still some requirements and improvements for a UWP App to WinUI3 Conversion feature.

  • [ ] UWP => Desktop, .wapproj should be configured to use .csproj as app entry point.
  • [ ] UWP => Desktop, old appxmanifest should use .wapproj and change entry point to FullTrustApplication.
  • [ ] Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace does not support new documents.
  • [ ] Application.OnLaunched Method needs to start window in a frame, Some UWP apps still use Window.Current which returns null in WinUI3. Create an Analyzer/CodeFix to update the C# source code?
  • [ ] Analyzers/Codfixes are slow. Implement batch fixer or edit multiple documents.
  • [ ] MultiTargeting Library .csproj converts properly but cannot be built. These are not errors with try-convert but WinUI3 and the WindowsCommunityToolkit.
  • [ ] Sometimes nuget.targets breaks try-convert #124 . Emit a better error message?
  • [ ] Roslyn Analyzers cannot parse .xaml files. Implement xml reader or find/replace to update to webview2?
  • [ ] Cpp Source Code cannot be converted.

MadEste avatar Sep 04 '20 16:09 MadEste

Thanks @MadEste!

cartermp avatar Sep 04 '20 18:09 cartermp

Roslyn Analyzers cannot parse .xaml files. Implement xml reader or find/replace to update to webview2?

@mrlacey for FYI on consuming the RapidXaml analyzers, which he demoed the WebView2 converter during the last community call

There are also some changes to IXP APIs that have been moved the .Experimental namespaces and are all prefixed with Exp. Depending on the timeline of this tool, we may want to update analyzer+code fixers to make these changes. I think the plan is that by May/June timeframe for these APIs to no longer be in the Experimental namespace, but if we do nothing, then it will make it hard to test/validate the end-to-end of this tool.

Edit: Here are the experimental namespaces:

Microsoft.UI.Composition.Experimental
Microsoft.UI.Hosting.Experimental
Microsoft.UI.Input.Experimental

stevenbrix avatar Oct 19 '20 15:10 stevenbrix

I have a PoC for converting WebView to WebView2 that also takes care of adding/using appropriate xmlns. This is at https://github.com/mrlacey/TryConvertXaml/blob/main/TryConvertXamlSample/Program.cs

It's based on functionality from https://aka.ms/rxt

I just need to remove the final dependency on the VisualStudio SDK (it was originally solely a VSIX) and then can have it target .NET Standard. Due to the uncertainty of a timeline for this it wasn't previously a priority, but working on this again now.

mrlacey avatar Oct 19 '20 15:10 mrlacey

Due to the uncertainty of a timeline for this it wasn't previously a priority, but working on this again now.

@mrlacey my apologies if I gave a pretense that we were looking into the xaml analyzers soon. There is still no real certain timeline yet, so please don't feel rushed. After Preview3 we could look into this, but then it's the holiday season, so it's a real possibility this won't be picked up until the new year.

stevenbrix avatar Oct 19 '20 16:10 stevenbrix

Due to the uncertainty of a timeline for this it wasn't previously a priority, but working on this again now.

@mrlacey my apologies if I gave a pretense that we were looking into the xaml analyzers soon. There is still no real certain timeline yet, so please don't feel rushed. After Preview3 we could look into this, but then it's the holiday season, so it's a real possibility this won't be picked up until the new year.

Ok. Just wanted to get the current limitation documented and note that I was working on it. Just bumping it up my own internal backlog as it has other benefits for me too. I want to make sure it is done before it's needed here.

mrlacey avatar Oct 20 '20 13:10 mrlacey

Also this just came to mind, is how do we convert .csproj which are using a C++ runtime component. you now need to create an interop project in most cases, and it's a non-trivial amount of work to do so

/cc @angelazhangmsft

stevenbrix avatar Oct 28 '20 16:10 stevenbrix

Is there a build of the WinUI branch available or should I build from source?

Marv51 avatar Feb 22 '21 09:02 Marv51

If and when this gets picked up again, I have an improved version of my library that can be used for the XAML changes. It's improved on the basis that this version:

  • is much smaller
  • has fewer dependencies
  • is now netStandard2.0 (so can be used anywhere)

mrlacey avatar Jun 19 '21 19:06 mrlacey