制作一个C#项目DLL和EXE [英] Making a C# project DLL and EXE

查看:145
本文介绍了制作一个C#项目DLL和EXE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个项目,我需要一个可执行文件,以便用户可以运行配置界面和一个可以嵌入到其他项目中的DLL来使用其他一些功能。有没有办法使Visual Studio生成可执行文件和DLL(而不是每次手动切换)?

解决方案

我同意TJMonk15,但我认为这应该明确解释。你应该有两个项目,一个项目是一个DLL,一个是一个正常的项目。 DLL项目应该有所有可重用的代码。正常的项目应该是您正在构建的应用程序,这将引用您的可重用DLL。这样,您可以在DLL项目中构建一个可以用于任何未来项目的框架。



一个很好的例子就是你在玩游戏时。你的游戏引擎将是DLL,你所做的游戏将是可执行项目。可执行项目将包含所有不可重用的特征,如游戏GUI和内容。


I'm working on a project where I need to have both an executable so that the user can run a configuration interface and a DLL that can be embedded in other projects to use some of the other features. Is there a way to make Visual Studio produce both an executable and a DLL (as opposed to switching it manually every time)?

解决方案

I agree with TJMonk15, but i think this should be explained explicitly. You should have two projects, one project that is a DLL, and one that is a normal project. The DLL project should have all your re-usable code. The normal project should be the application you are building, which will reference your re-usable DLL. This way you can build a framework in the DLL project that can be used for any of your future projects.

A good example of this is when you are making a game. Your game engine would be the DLL, and the game you are making would be the executable project. The executable project will contain all the non-reusable traits such as game GUIs and content.

这篇关于制作一个C#项目DLL和EXE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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