如何在Visual Studio或其他构建工具中的一个C#项目中生成dll和exe的混合? [英] how to produce a mix of dll and exe in one C# project in visual studio or other build tools?

查看:229
本文介绍了如何在Visual Studio或其他构建工具中的一个C#项目中生成dll和exe的混合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Visual Studio或其他构建工具的一个C#项目中生成dll和exe的混合?
在技术上可行吗?
是的,我知道它可以在2个或更多项目中完成。

how to produce a mix of dll and exe in one C# project in visual studio or other build tools ? Is it technically possible ? Yes I know it can done in 2 or more projects .

推荐答案

我不确定您提出问题的动机是什么,因为您可以引用.Net可执行文件,就像还是可以找到一个dll,但是您可以考虑将exe文件复制到同名的dll文件中(是​​的,这是黑客行为,但不确定您的动机)。

I'm not sure what the motivations for your question are, as you can reference a .Net executable as if it were a dll anyway, but you could consider copying the exe file to a dll file with the same name (yes it's a hack but not sure of your motivations).

您可以使用针对您的项目的 Visual Studio生成后事件使此过程自动化。每次成功构建后,这将处理创建dll副本:

You can automate this process using a Visual Studio post-build event for your project. This will handle creating the dll copy each time you have a successful build:

copy "$(TargetPath)" "$(TargetDir)$(TargetName).dll"

这篇关于如何在Visual Studio或其他构建工具中的一个C#项目中生成dll和exe的混合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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