nulastudio / NetBeauty2

Move a .NET Framework/.NET Core app runtime components and dependencies into a sub-directory and make it beauty.
MIT License
418 stars 21 forks source link

After using Prism + MVVM and publishing, the program cannot start #69

Open alexinea opened 2 weeks ago

alexinea commented 2 weeks ago

In my WPF application, Prism and CommunityToolkit.Mvvm are used to operate a counter through the view model. When I don't use NetBeauty 2.0, the program can run normally in both Debug mode and Release mode. However, when I use NetBeauty 2.0 and publish the application, the program cannot start.

To confirm the correctness of the .csproj configuration I used, I used NetBeauty 2.0 in another blank .NET WPF project (and used exactly the same configuration), but without using Prism + CommunityToolkit.Mvvm. After publishing, I found that the application can work normally.

I am not sure whether there is a problem with my usage or there are some minor compatibility issues between NetBeauty 2.0 and MVVM.

So, asccording to the author's suggestion, I prepared a demo in order to reproduce this problem:

WPFNetBeautyDemo.zip

I wonder if there are other users who have encountered similar problems?

Thanks.

liesauer commented 2 weeks ago

workaround here:

<BeautyExcludes>Prism</BeautyExcludes>

some assemblies must be inside the root dir and cannot be moved for some reasons, just like the wpf core assemblies.

need to debug inside the nbloader to find out why Prism works in this way.

https://github.com/nulastudio/NetBeauty2/blob/b7db2564c707a6042de826ce07506a6266ee98fd/NetBeauty/src/manager/manager.go#L968-L972

alexinea commented 2 weeks ago

Indeed, as you described, as long as Prism is excluded, the program can run normally.

thx a lot :P