JUST DO IT ~

          我只想當個程序員

          c# 編譯指令 簡單使用 --- 技巧 可以參考 vs 的編譯語句..查看情況


          csc 編譯的情況

           

          輸出成lib
          csc /t:library /out:A.dll a.cs

           

          編譯另外一個文件 引用dll

          csc /r:acme.dll Test.cs


          D:\c_\1>MyTest.exe
          X value = 123

          D:\c_\1>csc /t:library /out:A.dll a.cs
          Microsoft (R) Visual C# 2005 編譯器 版本 8.00.50727.42
          用于 Microsoft (R) Windows (R) 2005 Framework 版本 2.0.50727
          版權所有 (C) Microsoft Corporation 2001-2005。保留所有權利。


          D:\c_\1>csc /r:A.dll MyTest.cs
          Microsoft (R) Visual C# 2005 編譯器 版本 8.00.50727.42
          用于 Microsoft (R) Windows (R) 2005 Framework 版本 2.0.50727
          版權所有 (C) Microsoft Corporation 2001-2005。保留所有權利。


          D:\c_\1>MyTest.exe
          X value = 123

          D:\c_\1>











          編譯成類庫 

          csc /t:library acme.cs
           

          將此示例編譯為一個庫沒有Main入口點的代碼),并產生一個名為acme.dll的程序集。



           

          如果此程序存儲在文件test.cs那么在編譯test.cs可以使用編譯器的/r選項引用acme.dll程序集

          csc /r:acme.dll test.cs







          C:\Documents and Settings\gddg>csc /?
          Microsoft (R) Visual C# 2005 編譯器 版本 8.00.50727.42
          用于 Microsoft (R) Windows (R) 2005 Framework 版本 2.0.50727
          版權所有 (C) Microsoft Corporation 2001-2005。保留所有權利。

                                Visual C# 2005 編譯器選項

                                  - 輸出文件 -
          /out:<file>                   指定輸出文件名(默認值:
                                        包含主類的文件或第一個文件的基名稱)
          /target:exe                   生成控制臺可執行文件(默認) (縮寫: /t:exe)
          /target:winexe                生成 Windows 可執行文件 (縮寫: /t:winexe)
          /target:library               生成庫 (縮寫: /t:library)
          /target:module                生成能添加到其他程序集的模塊 (縮寫: /t:module)
          /delaysign[+|-]               僅使用強名稱密鑰的公共部分對程序集進行延遲簽名
          /doc:<file>                   要生成的 XML 文檔文件
          /keyfile:<file>               指定強名稱密鑰文件
          /keycontainer:<string>        指定強名稱密鑰容器
          /platform:<string>            限制可以在其上運行此代碼的平臺: x86、Itanium、x64
                                        或 anycpu。默認值為 anycpu。

                                  - 輸入文件 -
          /recurse:<wildcard>           根據通配符規范,包括當前目錄和子目錄下的所有文件
          /reference:<alias>=<file>     使用給定的別名從指定的程序集文件引用元數據 (縮寫:
                                        /r)
          /reference:<file list>        從指定的程序集文件引用元數據 (縮寫: /r)
          /addmodule:<file list>        將指定的模塊鏈接到此程序集中

                                  - 資源 -
          /win32res:<file>              指定 Win32 資源文件(.res)
          /win32icon:<file>             使用該圖標輸出
          /resource:<resinfo>           嵌入指定的資源 (縮寫: /res)
          /linkresource:<resinfo>       將指定的資源鏈接到此程序集 (縮寫: /linkres)
                                        其中 resinfo 的格式是 <file>[,<string
          name>[,public|private]]

                                  - 代碼生成 -
          /debug[+|-]                   發出調試信息
          /debug:{full|pdbonly}         指定調試類型(“full”是默認類型,可以將調試程序附
                                        加到正在運行的程序)
          /optimize[+|-]                啟用優化 (縮寫: /o)

                                  - 錯誤和警告 -
          /warnaserror[+|-]             將所有警告報告為錯誤
          /warnaserror[+|-]:<warn list> 將特定警告報告為錯誤
          /warn:<n>                     設置警告等級(0-4) (縮寫: /w)
          /nowarn:<warn list>           禁用特定的警告消息

                                  - 語言 -
          /checked[+|-]                 生成溢出檢查
          /unsafe[+|-]                  允許“不安全”代碼
          /define:<symbol list>         定義條件編譯符號 (縮寫: /d)
          /langversion:<string>         指定語言版本模式: ISO-1 或 Default

                                  - 雜項 -
          @<file>                       有關更多選項,請閱讀響應文件
          /help                         顯示此用法信息 (縮寫: /?)
          /nologo                       取消編譯器版權信息
          /noconfig                     不要自動包含 CSC.RSP 文件

                                  - 高級 -
          /baseaddress:<address>        要生成的庫的基址
          /bugreport:<file>             創建“Bug 報告”文件。
          /codepage:<n>                 指定打開源文件時要使用的代碼頁
          /utf8output                   以 UTF-8 編碼格式輸出編譯器消息
          /main:<type>                  指定包含入口點的類型(忽略所有其他可能的入口點)
                                        (縮寫: /m)
          /fullpaths                    編譯器生成完全限定路徑
          /filealign:<n>                指定用于輸出文件節的對齊方式
          /pdb:<file>                   指定調試信息文件名(默認值: 擴展名為 .pdb
                                        的輸出文件名)
          /nostdlib[+|-]                不引用標準庫(mscorlib.dll)
          /lib:<file list>              指定要在其中搜索引用的附加目錄
          /errorreport:<string>         指定如何處理內部編譯器錯誤: prompt、send、queue 或
                                        none。默認值為 queue。
          /moduleassemblyname:<string>  此模塊所屬程序集的名稱。


          C:\Documents and Settings\gddg>

           

           

           

           

           

           

           

           

           資源文件編譯近  執行文件

           

           

          /*
          Perform the following steps to use this code example:

          Main assembly:
          1) In a main directory, create a file named "rmc.txt" that
          contains the following resource strings:

          day=Friday
          year=2006
          holiday="Cinco de Mayo"

          2) Use the resgen.exe tool to generate the "rmc.resources"
          resource file from the "rmc.txt" input file.

          > resgen rmc.txt

          D:\c_\resx_資源文件編輯>"C:\Program Files\Microsoft Visual Studio 8\SmartDevices
          \SDK\SDKTools\resgen" rmc.txt
          Read in 4 resources from 'rmc.txt'
          Writing resource file...  Done.


          Satellite Assembly:
          3) Create a subdirectory of the main directory and name the
          subdirectory "es-ES", which is the culture name of the
          satellite assembly.

          4) Create a file named "rmc.es-ES.txt" that contains the
          following resource strings:

          day=Viernes
          year=2006
          holiday="Cinco de Mayo"

          5) Use the resgen.exe tool to generate the "rmc.es-ES.resources"
          resource file from the "rmc.es-ES.txt" input file.

          > resgen rmc.es-ES.txt

          6) Use the al.exe tool to create a satellite assembly. If the
          base name of the application is "rmc", the satellite assembly
          name must be "rmc.resources.dll". Also, specify the culture,
          which is es-ES.

          > al /embed:rmc.es-ES.resources /c:es-ES /out:rmc.resources.dll

          7) Assume the filename for this code example is "rmc.cs". Compile
          rmc.cs and embed the main assembly resource file, rmc.resources, in
          the executable assembly, rmc.exe:

          >csc /res:rmc.resources rmc.cs

          8) Execute rmc.exe, which obtains and displays the embedded
          resource strings.
          */

           

           

           

          D:\c_\resx_資源文件編輯\test2>csc /res:rmc.resources /res:rmc.es-ES.resources  r
          mc.cs
          Microsoft (R) Visual C# 2005 編譯器 版本 8.00.50727.1433
          用于 Microsoft (R) Windows (R) 2005 Framework 版本 2.0.50727
          版權所有 (C) Microsoft Corporation 2001-2005。保留所有權利。


          D:\c_\resx_資源文件編輯\test2>rmc
          Obtain resources using the current UI culture.
          "Cinco de Mayo" will occur on Friday in 2006.

          資源文件名稱 rmc
          Obtain resources using the es-ES culture.
          "Cinco de Mayo" will occur on Friday in 2006.


          D:\c_\resx_資源文件編輯\test2>dir
           驅動器 D 中的卷沒有標簽。
           卷的序列號是 04BF-7EB7

           D:\c_\resx_資源文件編輯\test2 的目錄

          2008-09-23  07:45    <DIR>          .
          2008-09-23  07:45    <DIR>          ..
          2008-09-23  06:50               318 rmc.es-ES.resources
          2008-09-23  07:15             4,338 rmc.cs
          2008-09-23  06:53               323 rmc.resources
          2008-09-23  08:01             4,608 rmc.exe
                         4 個文件          9,587 字節
                         2 個目錄  2,158,411,776 可用字節

           

           

           

           

           

           


          D:\c_\resx_資源文件編輯\test2>csc /res:rmc.resources /res:rmc.es-ES.resources  r
          mc.cs
          Microsoft (R) Visual C# 2005 編譯器 版本 8.00.50727.1433
          用于 Microsoft (R) Windows (R) 2005 Framework 版本 2.0.50727
          版權所有 (C) Microsoft Corporation 2001-2005。保留所有權利。


          D:\c_\resx_資源文件編輯\test2>rmc
          Obtain resources using the current UI culture.
          "Cinco de Mayo" will occur on Friday in 2006.

          資源文件名稱 rmc.es-ES
          Obtain resources using the es-ES culture.
          "Cinco de Mayo" will occur on Viernes in 2006.

           

           


           




          posted on 2008-02-07 16:32 小高 閱讀(975) 評論(0)  編輯  收藏 所屬分類: DotNet

          導航

          <2008年2月>
          272829303112
          3456789
          10111213141516
          17181920212223
          2425262728291
          2345678

          統計

          常用鏈接

          留言簿(3)

          隨筆分類(352)

          收藏夾(19)

          關注的blog

          手冊

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 通城县| 甘泉县| 阿克苏市| 若尔盖县| 舒城县| 天津市| 方正县| 松潘县| 滦平县| 临江市| 沙洋县| 浏阳市| 彭山县| 龙胜| 吉隆县| 六枝特区| 景泰县| 娄烦县| 嘉善县| 安新县| 饶阳县| 开远市| 大英县| 郁南县| 怀化市| 农安县| 高雄市| 陆良县| 宁化县| 张掖市| 栖霞市| 永寿县| 铁岭市| 百色市| 大关县| 米泉市| 房山区| 额尔古纳市| 宣武区| 蒙阴县| 信宜市|