将C#项目打包到dll或另一个库 [英] Pack C# project to dll or another library
问题描述
我有一个包含许多类的C#项目.是否可以将该项目(控制台应用程序)打包到库(可能是dll或其他任何文件)中,并从其他编程语言调用确定类的所有功能?
这是代码:
}
以及项目文件夹中的层次结构:
- 特性
- 参考
-箱
-调试
-Test.dll
--- Test.exe
-Test.pdb
-Test.vshost.exe
-Test.vshost.exe.manifest
-obj
-x86
---调试
---- TempPE
----- DesignTimeResolveAssemblyReferencesInput.cache
----- Test.csproj.FileListAbsolute.txt
----- Test.dll
----- Test.pdb
----- ResolveAssemblyReference.cache
-Program.cs
我检查了来自bin和obj的Test.dll.他们是空的
在生成项目时,您会在相应的bin文件夹中找到dll.
您可以通过添加对此dll的引用来在其他项目中使用此dll.之后,您可以使用其方法.
I have a C# project with many classes. Is it possible to pack this project(Console application) into library(maybe dll or anything else) and invoke all functions of a definite class from other programming languages?
EDIT:
Here is the code:
using System; using System.Text;namespace Test { class Program { public int aplusb(int a, int b) { return a + b; }
public void hello() { Console.WriteLine("Helo world"); } }
} And the hierarchy in project folder: - Properties - References - bin -- Debug --- Test.dll --- Test.exe --- Test.pdb --- Test.vshost.exe --- Test.vshost.exe.manifest - obj -- x86 ---Debug ----TempPE ----- DesignTimeResolveAssemblyReferencesInput.cache ----- Test.csproj.FileListAbsolute.txt ----- Test.dll ----- Test.pdb ----- ResolveAssemblyReference.cache - Program.cs
I checked both Test.dll from bin and obj. They are empty
when you build the project you get the dll in the corresponding bin folder.
You can use this dll in other project by adding reference to this dll. After that you can use its methods.
这篇关于将C#项目打包到dll或另一个库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!