【问题标题】:Compiling a dll from a vb.net assembly从 vb.net 程序集编译 dll
【发布时间】:2011-08-19 10:33:26
【问题描述】:

我正在尝试在 VB.Net 中制作一个非常基本的服务器控件,并且正在通过我自己的 bloody awful walkthrough 版本进行工作。

我已经到了这一点(刚刚超过页面的一半)......

将控件编译成程序集并嵌入图标

1) 打开 Visual Studio 命令提示符窗口。了解更多信息, 请参阅使用 csc.exe 构建命令行。

2) 在命令行,切换到包含自定义的目录 控制类文件。

如何在命令提示符窗口中“切换到目录”?

对于我可能遇到的问题的任何其他有先见之明的建议也非常受欢迎! :D

更新

我现在在 Visual Studio Command Prompt 独立应用程序中,并且有过这样的讨论...

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??

更新

对于任何处于类似位置的可怜的不幸者,我最终会这样做......

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>"

【问题讨论】:

    标签: visual-studio-2008 dll custom-server-controls


    【解决方案1】:

    确保您使用的是 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

    【讨论】:

    • 确保您使用的是正确的工具。请参阅上面我编辑的帖子。
    • 感谢您的更新 - 我已经从“开始”菜单打开了 Microsoft Visual Studio 命令提示符 - 它看起来更像 cmd。我已经设法使用cd 来更改目录。我正在尝试运行此命令:vbc D:\data\custom controls\CustomTree\CustomTree.vb /out:CustomTree.dll /r:System.dll /r:System.Web.dll 然后由于路径中的空格而无法找到该文件...
    • cd 实际上看起来并没有改变目录 - 但它没有抛出错误 - 提示仍然显示&gt;之前的原始路径...
    • 无法帮助您解决 cd 问题。如果使用得当,它应该可以正常工作。我更新了解决路径中空格的答案。哦,既然我的回答解决了你原来的问题,请不要犹豫接受它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-28
    • 2011-05-10
    • 1970-01-01
    • 2018-05-10
    相关资源
    最近更新 更多