应用程序输出文件(.exe)应在visual studio 2008中的构建时更改为(.dll) [英] Application output file (.exe) should change to (.dll) on build in visual studio 2008

查看:88
本文介绍了应用程序输出文件(.exe)应在visual studio 2008中的构建时更改为(.dll)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目在 windows窗体上生成并返回输出( .exe ),但我希望它返回输出文件在( .dll )中。

我想在 dll文件中使用它的原因是因为该软件具有一些每个用户都不应拥有的附加功能。



注意: - 我无法从<$ c $更改项目输出类型 c> windows应用程序到 console 因为稍后我需要运行该文件。



如果您对此问题有任何疑问,请随时问我。







谢谢advance

I have a project that is made on windows form and returns output (.exe) but i want it to return output file in (.dll).
The reason why i want it in dll file is because this software has some additional features which every user shouldn't posses.

Note:- i cannot change projects output type from windows application to console because later i need to run that file.

Please feel free to ask me if you have any query regarding this question.



Thanks in advance

推荐答案

应用程序类型应该是类库。



是的,我的意思是。然后,在库中,您不需要入口点(静态 Main 方法)。但是如果你把它留在那里,那么库仍然可以工作:你可以在其他应用程序中引用它,然后使用你的DLL中的表单。从技术上讲,DLL是唯一不同的功能:它不需要这个方法。



你需要明白在.NET中没有根本区别。 EXE和.DLL。中心概念是 assembly ,PE文件是 modules 。程序集可以有多个模块,但Visual Studio直接支持每个程序集只创建一个模块。然后程序集可以互相引用。我可以告诉你更多:即使你按原样保留.EXE,它也可以被其他一些程序集引用为.EXE。有些情况下这样做会带来一些实际意义,例如简单的插件架构。



-SA
Application type should be "class library".

Yes, I mean it. And then, in a library, you don't need entry point (static Main method). But if you leave it there, the library will still work: you can reference it in other application and then use the forms from your DLL. Technically, the only different feature if DLL is: it is not required to have this method.

You need to understand that in .NET there is no fundamental difference between .EXE and .DLL. The central concept is assembly, and PE files are modules. An assembly can have more than one module, but Visual Studio directly supports creation of only one per assembly. And then assemblies can reference each other. I can tell you more: even if you leave your .EXE as is, it can be referenced by some other assembly exactly as .EXE. There are even cases when doing so makes some practical sense, for example, simple plug-in architectures.

—SA


这篇关于应用程序输出文件(.exe)应在visual studio 2008中的构建时更改为(.dll)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆