在 C# 中创建导出函数并使用 csc.exe 进行编译

时间:2021-03-21 19:49:02

标签: c# dll export csc

我有一个用 C# 编写的简单 hello world。

plotSex(getSex(GRset, cutoff = -2))

我可以使用:

using System;

public class Program
{
    public static void test()
    {
        Console.WriteLine("Hello from Atomic Red Team! \n Press Enter To Close.");
        Console.ReadLine();
    }
}

我想让 test() 函数成为一个导出函数,以便我可以使用 rundll32.exe。 例如:

Csc.exe /target:library /out:test.dll test.cs

我会尝试添加 [DllExport(ExportAs = "test")] 但它不会编译.. 唯一的要求是我可以用 csc.exe 编译它

0 个答案:

没有答案