我编写了一个简单的VB.NET应用程序,它在开发机器上运行良好。
然而,在另一台机器上,即使安装了.NET框架,它在使用System.InvalidOperationException启动时也会崩溃。
查找Visual Basic程序集似乎有问题。
以下是其中一个失败之处(我用三个点替换了敏感信息):
*** Assembly Binder Log Entry (16/06/2013 @ 15:45:12) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\....
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = ...
LOG: DisplayName = Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Users/......
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSystemAdmin.exe
Calling assembly : MSystemAdmin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/.../Desktop/Microsoft.VisualBasic.PowerPacks.Vs.DLL.
LOG: Attempting download of new URL file:///C:/.../Desktop/Microsoft.VisualBasic.PowerPacks.Vs/Microsoft.VisualBasic.PowerPacks.Vs.DLL.
LOG: Attempting download of new URL file:///C:/.../Desktop/Microsoft.VisualBasic.PowerPacks.Vs.EXE.
LOG: Attempting download of new URL file:///C:/.../Desktop/Microsoft.VisualBasic.PowerPacks.Vs/Microsoft.VisualBasic.PowerPacks.Vs.EXE.
LOG: All probing URLs attempted and failed.发布于 2013-06-16 22:45:30
目前还不清楚PowerPacks为什么会丢失,.NET 4客户端配置文件可能是一个问题。PowerPacks已经有了多个版本,版本编号变得一团糟。在我的机器上,该版本报告为v2.0.50727,尽管它作为版本10.0存储在GAC中
最好的办法是回到你的项目中去。单击“解决方案资源管理器”窗口中工具栏上的“显示所有文件”图标。现在显示了References节点。展开它并选择PowerPacks引用。在“属性”窗口中,将“复制本地”属性更改为True。
Rebuild和您的build目录现在将拥有DLL的副本。将其与EXE一起复制到目标计算机上。
发布于 2014-04-09 10:06:13
这是下载Microsoft Visual Basic Power Pack 10.0的URL
http://go.microsoft.com/fwlink/?LinkID=145727&clcid=0x804
发布于 2013-06-16 22:15:33
显然,这似乎是“PowerPacks”的问题;这些是Visual Studio中默认给出的控件的附加控件(在窗体设计部分的“工具箱”下)。如果您在目标计算机上安装了required package,则一切正常。
我以前遇到过这个问题,我的建议不依赖于这些元素:它们包括一些漂亮的特性(在我的例子中,它是一个椭圆形),但可能会被一些工作和更简单的对象所取代。如果您想要将您的程序或多或少地销售给更广泛的受众,依赖于此可能会成为一个问题:此程序包不会默认安装在几乎任何计算机上,因此您必须要求您的客户端继续安装。定位这些特定控件很简单:在“工具箱”中,它们应该列在"PowerPacks“或类似的下面。
在阅读了Hans Passant的评论后,我确实记得必须将.dll文件放在与可执行文件相同的目录中,但我的印象是,无论如何都必须安装来自所提供的链接的PowerPacks包(至少,在没有Visual Studio的计算机上)。
https://stackoverflow.com/questions/17133879
复制相似问题