开发者

Converting a C# WinForms application to an assembly?

开发者 https://www.devze.com 2022-12-30 04:58 出处:网络
I have a C# WinForms application which is running fine. Now I want to convert it to an assembly and use it in an ASP.NET Web application.

I have a C# WinForms application which is running fine. Now I want to convert it to an assembly and use it in an ASP.NET Web application.

开发者_开发百科How do I choose which DLLs to reference?


It depends on which classes and methods you want to use. If they are in the exe, you can simply rename a.exe to a.dll. Then a.dll can be added as reference, and you can consume the public classes.

Noticeably that many things used in WinForms applications are not feasible or applicable to ASP.NET applications and can lead to serious performance issues. This is because WinForms and ASP.NET have different process models. Pay attention to that before it bites you.


You know ASP.NET allows you to use C# code right? Sounds like you just need to reconsider the GUI portion of the app for web usage and then you should be set.

This may or may not be easy. But if you wrote your code with an adequate separation of user interface and actual doing (or business) logic, then it should be easy enough.


Rename the yourapp.EXE to yourapp.DLL and it as reference to any .Net application be it asp.net web or windows. Anything in compiled form in .Net contains MSIL which is a fair candidated for being referenced from any .net application. Just make sure the application also references dependant assemblies and libraries used by the EXE. Like, System.Windows.Forms, etc..

0

精彩评论

暂无评论...
验证码 换一张
取 消