把其他类库生成的dll,和现在的exe打包在一起,发给别人的时候,就发一个exe即可。
一共二种方法
第一种
1.建立一个类库项目
代码
生成dll
2.建立一个winform项目
3.在项目中把dll引用里面去
4.把dll直接复制到项目的根目录中
并且修改下面2项
5.回到项目的界面上,在按钮中增加ClassLibrary1.dll的方法
6.在启动的地方加上代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
//WindowsFormsApp2 这个是主程序的命名空间
string resourceName = "WindowsFormsApp2." + new AssemblyName(args.Name).Name + ".dll";
using (var stream =