首页 > 代码库 > c# 01/26/2015

c# 01/26/2015

右侧栏 project 下properties 点中 再把output改成 class library 会在 ..\bin\Debug 下生成 .dll 文件


设置 set up startup project 设置成启动工程


C:\Windows\Microsoft.NET\Framework\v4.0.30319 下的csc.exe 就是 c#的编译器


using System;
 
public class Helloworld
{
               public static void Main(string[] args) 
               {
                               Console.WriteLine("Hello World");
                               Console.WriteLine("Enter any key to exit...");
                               Console.Read();
               }
}


developer Command Prompt for vs2012.exe 工具


1.C:\Program Files (x86)\Microsoft Visual Studio 11.0> csc /?

---csc的用法


2.C:\Program Files (x86)\Microsoft Visual Studio 11.0>csc /t:exe /out:C:\Users\jz9

1129\Documents\Visual Studio 2012\temporary\helloword.exe C:\Users\jz91129\Docum

ents\Visual Studio 2012\temporary\helloworld.cs

Microsoft (R) Visual C# Compiler version 4.0.30319.18408

for Microsoft (R) .NET Framework 4.5

Copyright (C) Microsoft Corporation. All rights reserved.


error CS2001: Source file ‘Studio‘ could not be found

error CS2001: Source file ‘2012\temporary\helloword.exe‘ could not be found

error CS2001: Source file ‘C:\Users\jz91129\Documents\Visual‘ could not be found

error CS2001: Source file ‘Studio‘ could not be found

error CS2001: Source file ‘2012\temporary\helloworld.cs‘ could not be found

warning CS2008: No source files specified


C:\Program Files (x86)\Microsoft Visual Studio 11.0>csc /t:exe /out:C:\cstemp\he

lloworld.exe C:\cstemp\helloworld.cs

Microsoft (R) Visual C# Compiler version 4.0.30319.18408

for Microsoft (R) .NET Framework 4.5

Copyright (C) Microsoft Corporation. All rights reserved.



C:\Program Files (x86)\Microsoft Visual Studio 11.0>

可见 路径里面不可以有空格


3.>ildasm --反编译.net的exe和dll文件


4.> sn /? 生成一对公钥私钥对

在工程--> properties 中 signing --> browser-->加入生成的snk


5.c:\windows\assembly 电脑上所有的公共assembly


6.homework

 --Strong name an assembly

 --Add to GAC

参考资料:


http://www.cnblogs.com/lly001001/archive/2012/05/24/2515930.html

https://msdn.microsoft.com/en-us/library/ex0ss12c(v=vs.110).aspx



c# 01/26/2015