Search code examples
visual-studio-2008dllcustom-server-controls

Compiling a dll from a vb.net assembly


I'm attempting to make a very basic server control in VB.Net and am working my way through my own version of this bloody awful walkthrough.

I have got up to this bit (just over halfway down the page)...

To compile the control into an assembly and embed the icon

1) Open the Visual Studio Command Prompt window. For more information, see Command-line Building With csc.exe.

2) At the command line, switch to the directory that contains the custom control class files.

How do I 'switch to directory' in the Command Prompt window?

Any other prescient advice on problems I may encounter would be more than welcome also! :D

UPDATE

I'm now in Visual Studio Command Prompt standalone app and have had this discourse...

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>

As you can see it gives me no indication that it's built a dll (probably becuase it hasn't).

How do I compile CustomTreeView.vb to a dll??

UPDATE

For any poor unfortunates in a similar position I ended up doing...

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

ie

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

Solution

  • Make sure you're using the Visual Studio Command Prompt (an application similar to cmd, which can be found in your VS installation directory), not the integrated Command Window in VS.

    Usually it is located here: [Your Visual Studio Dir]\VC\vcvarsall.bat

    Then try the DOS command to change the directory: cd

    Solve the issue with the spaces in the path by surrounding it with quotation marks like this:

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

    For further reference, here's the MSDN documentation on how to invoke the command-line compiler.