我有两个项目的解决方案如何在winforms项目中使用库类型项目中的方法?

时间:2016-07-21 19:27:08

标签: c# .net winforms

第一个项目是类库。 我不能只运行它所以我添加了一个winforms项目,所以我可以使用库方法和类,所以我可以调试库项目。

但我无法从winforms中获得Lubrary项目。 在winforms中:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }


        private void timer1_Tick(object sender, EventArgs e)
        {

        }
    }
}

图书馆项目名称是AviFile,里面有课程。

当我输入计时器刻度事件AviFile时,它不存在。

1 个答案:

答案 0 :(得分:1)

右键点击AviFile - >,您需要在winform项目中添加名为Reference的类库项目的引用。添加参考 - >选择项目 - >选择dll并选择OK。

然后在您的Form类中导入名为using AviFile;

的命名空间

有关如何操作的信息,请参阅MSDN Documentation

相关问题