unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.08k stars 736 forks source link

UWP could not creat envet #11267

Closed ZGHHGZ closed 1 year ago

ZGHHGZ commented 1 year ago

Current behavior

image image

Expected behavior

No response

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

No response

Works on UWP/WinUI

Yes

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia, Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia, Uno.SourceGenerationTasks, Uno.UI.RemoteControl / Uno.WinUI.RemoteControl

NuGet package version(s)

No response

Affected platforms

Windows

IDE

No response

IDE version

Visual Studio 2022 17.5.0 Preview6.0

Relevant plugins

No response

Anything else we need to know?

I want creat event in UWP project

Youssef1313 commented 1 year ago

Are you using a shared project?

ZGHHGZ commented 1 year ago

Yes

ZGHHGZ commented 1 year ago

When I double click UI in xaml desingner , visual studio tell me that is error, it couldn't creat events, sometimes visual studio will breakdown when I double click。

Youssef1313 commented 1 year ago

This is a problem on Visual Studio side. Not something that Uno controls. However, the new templates no longer use a shared project, so in the new templates you will be able to create the event normally.

ZGHHGZ commented 1 year ago

How can I use the new templates ?

ZGHHGZ commented 1 year ago

@Youssef1313 Is it the next version ?

Youssef1313 commented 1 year ago

If you are creating a project from scratch, the latest -dev solution template packages should have the new project structure.

If you have an existing project, you probably need to manually migrate to the new structure.

@jeromelaban Do we have any documentation for moving from shared project to class lib?

ZGHHGZ commented 1 year ago

image

ZGHHGZ commented 1 year ago

I couldn't find the latest -dev solution template packages . This is newest version(4.7.37) in Visual Studio 2022

jeromelaban commented 1 year ago

This is indeed an issue on Visual Studio's side caused by Shared Projects that we cannot fix for UWP applications. It is resolved when building WinAppSDK applications, using our latest template.

If you want to stay on UWP, you may also try to create a cross-targeted library: image And move all the XAML files from the "shared project" to that new project, then reference it from the other heads.