2011-08-19 46 views
1

我試圖在VB.Net中創建一個非常基本的服務器控件,並且正在通過我自己的版本bloody awful walkthrough工作。從vb.net程序集編譯dll

我已經得到了該位(剛剛超過一半,頁面)...

要編譯控制到組裝和嵌入圖標

1)打開Visual Studio命令提示窗口。有關更多信息,請參閱 請參閱使用csc.exe進行命令行構建。

2)在命令行中,切換到包含自定義控制類文件的目錄 。

如何在命令提示符窗口中切換到目錄?

對於我可能遇到的問題,任何其他有先見之明的建議都會比歡迎! :d

UPDATE

我現在在Visual Studio命令提示符獨立的應用程序,並有過這樣的話語......

C:\Program Files\Microsoft Visual Studio 9.0\VC>vbc "D:\data\oconndr\ASP Custom 
Controls\CustomControls\CustomTreeView.vb" /t:library /out:CustomTree.dll /r:Sy 
stem.dll /r:System.Web.dll 
Microsoft (R) Visual Basic Compiler version 9.0.30729.1 
Copyright (c) Microsoft Corporation. All rights reserved. 


C:\Program Files\Microsoft Visual Studio 9.0\VC> 

正如你可以看到它讓我沒有任何跡象表明它是建立了一個DLL(可能是因爲它沒有)。

如何編譯CustomTreeView.vb到一個DLL?

UPDATE

對於在相似的位置我最後做任何不幸的人......

vbc /target:library /out:"D:\data\oconndr\ASP Custom Controls\CustomControls\CustomTree.dll" "D:\data\oconndr\ASP Custom Controls\CustomControls\CustomTreeView.vb" 

vbc /target:library /out:"<Target dll Path>" "<vb file path>" 

回答

2

確保您使用Visual Studio命令提示符(類似於cmd的應用程序,可在VS安裝目錄中找到),而不是VS中的集成命令窗口。

它通常位於:[Your Visual Studio Dir]\VC\vcvarsall.bat

那就試試DOS命令來更改目錄:通過這樣引號包圍它cd

解決路徑的空間的問題:

vbc "D:\data\custom controls\CustomTree\CustomTree.vb" /out:... 

有關進一步的參考,這裏是MSDN documentation on how to invoke the command-line compiler

+0

是的,VS命令提示符似乎沒有使用傳統的DOS語法... –

+0

請確保您使用的是正確的工具。看到我上面編輯的帖子。 –

+0

感謝您的更新 - 我已經從開始菜單打開了Microsoft Visual Studio命令提示符 - 這看起來更像是cmd。我設法使用'cd'來改變目錄。我試圖運行這個命令:'vbc D:\ data \ custom controls \ CustomTree \ CustomTree.vb/out:CustomTree。dll /r:System.dll/r:System.Web.dll'然後找不到該文件,因爲路徑中有空格... –