James K James K - 22 days ago 6
ASP.NET (C#) Question

ASP.NET Core support for hosting WPF/Silverlight components

If I wanted to render a legacy WPF app on a view within a new ASP.NET Core MVC application what would be the modern approach for this? Is this sort of thing still possible? Previously the obvious solution would have been Silverlight I guess.

Answer

Asp.Net core does not directly support silverlight or WPF. If you were able to get a silverlight app to be served up from an ASP.Netcore view I suspect you'd have to do it in some manually way because the tooling isn't going to help.

There really isn't any good way to render a legacy WPF app on a view using asp.net Core MVC. Even if you did port the WPF app to silverlight and managed to get the silverlight app to play nice with an ASP.Net Core view, you will have put in all that work to port to a technology (silverlight) that isn't accessible via many mobile devices and is likely to be phased out over time.

It may be worth thinking about what would be required to port the WPF app to Asp.Net Core MVC if you want the WPF app functionality available via a browser. That porting work would be more challenging than porting to silverlight but in the end you'd end up with an app that was on technology that has a much brighter future.

There is definitely a large learning curve to go from desktop apps to web apps due to the stateless nature of the Web and HTML/CSS/Javascript. I can totally understand wanting to leverage existing desktop app code. All non UI code can be moved to the web no problem but the UI parts will either need to be ported to Silverlight or MVC. You could go with a ASP.NET MVC 5 with a Silverlight approach then you'd have tooling support. But you should look into the projected longevity of Silverlight and make sure it aligns with your needs. And remember iPhone users won't be able to access the Silverlight App.