C # using Visual Studio will generate DLL files ways to use Visual Studio C # method will generate DLL files

Use Visual Studio C # method will generate DLL files

1. command mode

Open the Developer installation directory under the Visual Studio command prompt

Translation File.cs to produce File.exe

csc File.cs compiler to generate File.cs of File.dll with 
CSC / target: Library File.cs compiler generates a File.cs corresponding to the directory name in .dll file
csc /out:My.exe File.cs by using an optimized and define the DEBUG symbol, compile the current directory of all the C # file. Output File2.exe 
csc / the DEFINE: All of the C # compiler files in the current directory DEBUG / optimize /out:File2.exe * .cs, to produce a debug version of File2.dll. Does not display any logos and warning 
csc / target: library /out:File2.dll / warn : 0 / nologo / debug * .cs will compile all C # files in the current directory is Something.xyz (a DLL) 
csc / target: Library /out:Something.xyz * .cs compiler to generate File.cs of File.dll with 
csc / target: Library File.cs this is what we use most of a command, in fact, can simply be written as csc / t: library File.cs, in addition one was written csc /out:mycodebehind.dll / t: library mycodebehind.cs, this can specify your own output file name. 
csc /out:mycodebehind.dll / t: library mycodebehind.cs mycodebehind2.cs , this role is to install two cs file to a .dll file 

csc not an internal or external command, operable program solutions

For the VisualStudio2005
1: Right-click on "My Computer" - "Properties" - "Advanced" - "Environment Variables" - "System Variables"
will add the PATH: C: \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \
2: cs directly in the corresponding file folder directory execution environment dos
Path = C: \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \
3: the VisualStudio2005 command prompt
start - "program ---" Microsoft Visual Studio2005 ----> Visual Studio Tools --- > VisualStudio2005 command prompt
to copy cs file to the C: \ Program files \ in the Microsoft Visual Studio 8 \ VC \
4: C: \ Autoexec.bat
added: C: \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \

vs2008 under
C: \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \ CSC.EXE is in the 2.0 version
compiled with .cs file if using System.Linq; compiler pass, if not LINQ syntax deleted using System.Linq ; you can, or else call the C: \ WINDOWS \ Microsoft.NET \ Framework \ v3.5 in the CSC.EXE

SLN under the same direct access inside the class library.
Encapsulated DLL. Adding import DLL using namespace workers have access.

1. Tools mode

Generated directly inside the Visual Studio development software

 Reprinted from https://www.cnblogs.com/AaronBlogs/p/6840283.html

1. command mode

Open the Developer installation directory under the Visual Studio command prompt

Translation File.cs to produce File.exe

csc File.cs 编译 File.cs 以产生 File.dll 
csc /target:library File.cs 编译 File.cs 在该目录下产生一个对应名字的.dll文件
csc /out:My.exe File.cs 通过使用优化和定义 DEBUG 符号,编译当前目录中所有的 C# 文件。输出为 File2.exe 
csc /define:DEBUG /optimize /out:File2.exe *.cs 编译当前目录中所有的 C# 文件,以产生 File2.dll 的调试版本。不显示任何徽标和警告 
csc /target:library /out:File2.dll /warn:0 /nologo /debug *.cs 将当前目录中所有的 C# 文件编译为 Something.xyz(一个 DLL) 
csc /target:library /out:Something.xyz *.cs 编译 File.cs 以产生 File.dll 
csc /target:library File.cs这个就是我们使用最多的一个命令,其实可以简单的写成csc /t:library File.cs,另外的一个写法是 csc /out:mycodebehind.dll /t:library mycodebehind.cs,这个可以自己指定输出的文件名。 
csc /out:mycodebehind.dll /t:library mycodebehind.cs mycodebehind2.cs,这个的作用是把两个cs文件装到一个.dll文件里 

csc不是内部或外部命令,也不是可运行的程序解决方法

针对VisualStudio2005
1:右键点击"我的电脑"--"属性"--"高级"--"环境变量"--"系统变量"
将PATH中加上路径:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\
2:直接在dos环境的cs相应文件夹目录执行
Path=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\
3:VisualStudio2005命令提示
开始--》程序---》Microsoft Visual Studio2005---->Visual Studio Tools--->VisualStudio2005命令提示
把cs文件copy到C:\Program Files\Microsoft Visual Studio 8\VC\
4:C:\autoexec.bat
加入:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\

vs2008 下
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ 里的CSC.EXE 是2.0版本
编译的.cs文件如果带using System.Linq;编译通不过,如果不用LINQ语法删除using System.Linq;即可,否则 调用C:\WINDOWS\Microsoft.NET\Framework\v3.5里的CSC.EXE

同一SLN下 里面 class 直接访问类库。
封装到DLL。 导入DLL 添加using namespace 工有才能访问。

1.工具方式

直接在Visual Studio开发软件里面生成

 转载自https://www.cnblogs.com/AaronBlogs/p/6840283.html

Guess you like

Origin www.cnblogs.com/xiaoahui/p/11621056.html