-2

我有 2 个文件第一个:

public class Hello{ 
  public void hello(){
      System.Console.WriteLine("Hello!Hello!");
  }
}

第二个:

class App {
   public static void Main() { 
       Hello h = new Hello(); h.hello();
   }
}

我需要知道是什么意思并执行以下每一行

1 >sn -k hello.keys
2 >csc /t:library /keyfile:hello.keys hello.cs
3 >csc /t:exe /reference:hello.dll app.cs
4 > app
5 >csc /t:library /keyfile:hello.keys hello.cs
6 >app
7 >sn -k hello.keys
8 >csc /t:library /keyfile:hello.keys hello.cs
9 > app
10 >csc /t:library  hello.cs
11 >app

特别是“应用程序”行!谢谢您的帮助

4

2 回答 2

3
csc /t:library File.cs // Compiles File.cs producing File.dll

编译器 (csc) 选项列表

sn -k outfile //Generates a new key pair and writes it to the specified file.

强名称工具 (sn.exe) 概述

“app”是程序在行中使其成为可执行文件后的名称

csc /t:exe /reference:hello.dll app.cs
于 2013-06-19T19:59:39.883 回答
3

这里运行了三个命令:

  • sn - 用于创建强命名的键(没有使用这么多,所以不能多说)
  • csc - C# 编译器(因此是 csc)。这用于将源代码编译成 DLL (/t:library) 或可执行文件 (/t:exe)
  • app - 这是您刚刚创建的程序。

我不确定你从哪里得到这些,但看起来它可能是通过在各个阶段之间对源文件进行编辑来完成的。一口气运行所有这些肯定是没有意义的。

无论如何,这就是命令所做的简而言之。

于 2013-06-19T20:00:24.837 回答