• <i id='BBD8N'><tr id='BBD8N'><dt id='BBD8N'><q id='BBD8N'><span id='BBD8N'><b id='BBD8N'><form id='BBD8N'><ins id='BBD8N'></ins><ul id='BBD8N'></ul><sub id='BBD8N'></sub></form><legend id='BBD8N'></legend><bdo id='BBD8N'><pre id='BBD8N'><center id='BBD8N'></center></pre></bdo></b><th id='BBD8N'></th></span></q></dt></tr></i><div id='BBD8N'><tfoot id='BBD8N'></tfoot><dl id='BBD8N'><fieldset id='BBD8N'></fieldset></dl></div>
  • <tfoot id='BBD8N'></tfoot>

        <bdo id='BBD8N'></bdo><ul id='BBD8N'></ul>
      <legend id='BBD8N'><style id='BBD8N'><dir id='BBD8N'><q id='BBD8N'></q></dir></style></legend>

      <small id='BBD8N'></small><noframes id='BBD8N'>

      1. 是否可以从 vbscript 执行 .NET 程序集(dll)?

        Is it possible to execute a .NET assembly(dll) from vbscript?(是否可以从 vbscript 执行 .NET 程序集(dll)?)
        <i id='DNuYO'><tr id='DNuYO'><dt id='DNuYO'><q id='DNuYO'><span id='DNuYO'><b id='DNuYO'><form id='DNuYO'><ins id='DNuYO'></ins><ul id='DNuYO'></ul><sub id='DNuYO'></sub></form><legend id='DNuYO'></legend><bdo id='DNuYO'><pre id='DNuYO'><center id='DNuYO'></center></pre></bdo></b><th id='DNuYO'></th></span></q></dt></tr></i><div id='DNuYO'><tfoot id='DNuYO'></tfoot><dl id='DNuYO'><fieldset id='DNuYO'></fieldset></dl></div>

          <small id='DNuYO'></small><noframes id='DNuYO'>

          <legend id='DNuYO'><style id='DNuYO'><dir id='DNuYO'><q id='DNuYO'></q></dir></style></legend>

              <tbody id='DNuYO'></tbody>
                • <bdo id='DNuYO'></bdo><ul id='DNuYO'></ul>
                  <tfoot id='DNuYO'></tfoot>
                  本文介绍了是否可以从 vbscript 执行 .NET 程序集(dll)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想以同步方式从 vbscript 执行 .NET dll 文件 - 这可能吗?如果是,是否可以执行 GAC 程序集?

                  I'd like to execute a .NET dll file from vbscript in a synchronous way - is this possible? if yes, is it possible to execute a GAC assembly?

                  谢谢,提供

                  推荐答案

                  我认为您必须首先通过在 AssemblyInfo.cs 文件中包含 ComVisible 属性来使 .NET 程序集 COM 可见:

                  I think you must first make the .NET assembly COM-visible by including the ComVisible attribute in the AssemblyInfo.cs file:

                  [ComVisible(true)]
                  

                  在 MSDN 上查看此页面:打包程序集对于 COM

                  See this page on MSDN: Packaging an Assembly for COM

                  然后在 VBScript 中,您可以通过与访问 COM 组件相同的方式访问这些组件,即使用 CreateObject 或 Server.CreateObject,如下所示:

                  And then in VBScript you can access those components by the same means you access COM components, i.e. using CreateObject or Server.CreateObject as in:

                  Set testObj = CreateObject("MyNamespace.MyType")
                  

                  我认为 GAC 甚至可能强制从 VBScript 访问它,但我没有这样做,所以我不确定.

                  I think GAC might even be mandatory to access it from VBScript but I havn't done it this way around so I'm not sure.

                  为什么要在 VBScript 中执行此操作?为什么不直接制作一个 .NET 控制台应用程序来完成您的 VBScript 所要做的事情呢?由于 DLL 已经在 .NET 上,这应该不是问题,对吧?

                  Why would you want to do that in VBScript? Why not just make a .NET console application that would do what your VBScript was meant to do? Since the DLL is already on .NET, that shouldn't be a problem, right?

                  另一种方法可能是创建一个控制台 EXE 而不是 DLL(或包装 DLL 的 EXE),您可以像普通的可执行程序一样从 VBScript 调用它,并且检查返回结果.取决于许多因素,这可能比维护 COM 代码更灵活.

                  Another way to do this might be to create a console EXE instead of a DLL (or an EXE that wraps up a DLL) that you can call from VBScript like a normal executable program and examine return results. Depending on many factors, this might be more flexible than maintain COM code.

                  这篇关于是否可以从 vbscript 执行 .NET 程序集(dll)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                  Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                  How can I force the PropertyGrid to show a custom dialog for a specific property?(如何强制 PropertyGrid 显示特定属性的自定义对话框?)
                  Associate attribute with code generated property in .net(将属性与 .net 中的代码生成属性相关联)
                  Attribute to generate compilation error on method call?(在方法调用上生成编译错误的属性?)
                  Can you omit the parenthesis from attributes with no params?(您可以省略没有参数的属性中的括号吗?)
                  • <small id='WppAg'></small><noframes id='WppAg'>

                    <legend id='WppAg'><style id='WppAg'><dir id='WppAg'><q id='WppAg'></q></dir></style></legend>

                    • <bdo id='WppAg'></bdo><ul id='WppAg'></ul>
                      <tfoot id='WppAg'></tfoot>
                      <i id='WppAg'><tr id='WppAg'><dt id='WppAg'><q id='WppAg'><span id='WppAg'><b id='WppAg'><form id='WppAg'><ins id='WppAg'></ins><ul id='WppAg'></ul><sub id='WppAg'></sub></form><legend id='WppAg'></legend><bdo id='WppAg'><pre id='WppAg'><center id='WppAg'></center></pre></bdo></b><th id='WppAg'></th></span></q></dt></tr></i><div id='WppAg'><tfoot id='WppAg'></tfoot><dl id='WppAg'><fieldset id='WppAg'></fieldset></dl></div>
                          <tbody id='WppAg'></tbody>