授權編譯器 (Lc.exe)
授權編譯器可以讀取包含授權資訊的文字檔,並產生可被內嵌於 Common Language Runtime 可執行檔的 .licenses 檔案當做資源。
lc /target:targetPE /complist:filename [/outdir:path]
/i:modules [/nologo] [/v]
選項 | 說明 |
---|---|
/complist: filename |
指定要包含在 .licenses 檔案中含有授權元件清單的檔案名稱。使用元件的完整名稱與每行只有一個元件方式參考每個元件。 命令列使用者可以為專案中的每個格式指定個別的檔案。Lc.exe 接受多個輸入檔並產生單一 .licenses 檔案。 |
/h[elp] |
顯示工具的命令語法和選項。 |
/i: module |
指定包含列於 /complist 檔案中之元件的模組。若要指定一個以上的模組,請使用多個 /i 旗標。 |
/nologo |
隱藏 Microsoft 程式啟始資訊顯示。 |
/outdir: path |
指定要放置輸出 .licenses 檔案的目錄。 |
/target: targetPE |
指定要產生 .licenses 檔案的可執行檔。 |
/v |
指定詳細資訊模式;顯示編譯 (Compilation) 程序資訊。 |
/? |
顯示工具的命令語法和選項。 |
範例
如果您要使用名為
HostApp.exe
之應用程式中Samples.DLL
所包含的授權控制項MyCompany.Samples.LicControl1
,**可以建立包含下列程式碼的HostAppLic.txt
。MyCompany.Samples.LicControl1, Samples.DLL
使用下列命令建立這個稱為
HostApp.exe.licenses
的 .licenses 檔案。lc /target:HostApp.exe /complist:hostapplic.txt /i:Samples.DLL /outdir:c:\bindir
建置包含 .licenses 檔案當做資源的
HostApp.exe
。如果您正在建置 C# 應用程式,可以使用下列命令來建置應用程式。csc /res:HostApp.exe.licenses /out:HostApp.exe *.cs
下列命令會從由 hostapplic.txt
、hostapplic2.txt
和 hostapplic3.txt
所指定的授權元件清單編譯 myApp.licenses
。modulesList
引數是指定包含授權元件的模組。
lc /target:myApp /complist:hostapplic.txt /complist:hostapplic2.txt /complist: hostapplic3.txt /i:modulesList