有没有办法将我的类库程序更改为.exe
或单击一次应用程序?目前我把它作为一个DLL.我能够创建一次点击应用程序但安装后无法正常工作.
小智 27
在项目属性 - > application标签中,将Output类型更改为console Application.无论如何,您需要创建一个static Main()
方法作为起点.
static void Main(string[] args)
{
}
Run Code Online (Sandbox Code Playgroud)
Kja*_*tan 13
您可以在其设置中更改项目的输出类型,然后添加主入口点,正如其他人所提到的(注意,您想要"Windows应用程序",而不是"控制台应用程序"):
如果由于某种原因无法更改源,可以创建一个新的非常简单的应用程序(.exe),并从中调用.dll中的公共方法:
namespace YourNamespace
{
internal class YourApp
{
private static void Main(string[] args)
{
// Call your function here.
}
}
}
Run Code Online (Sandbox Code Playgroud)
为此,您只需要将现有.dll的引用包含到此新应用程序中.