我写了一个简单的 VB.NET 应用程序,它在开发机器上运行良好。
然而,在另一台机器上,即使安装了 .NET Framework,它在启动时也会崩溃,并出现 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.
最佳答案
不清楚为什么缺少 PowerPacks,.NET 4 Client Profile 可能是一个问题。周围有多个版本的 PowerPack,版本编号变得一团糟。在我的机器上,相同的版本被报告为 v2.0.50727,即使它作为版本 10.0 存储在 GAC 中
最好的办法是回到你的项目。单击“解决方案资源管理器”窗口中工具栏上的“显示所有文件”图标。现在显示引用节点。展开它并选择 PowerPacks 引用。在“属性”窗口中,将“复制本地”属性更改为 True。
重新构建,您的构建目录现在将拥有 DLL 的副本。将它与 EXE 一起复制到目标机器上。
关于vb.net - 应用程序在启动时崩溃 - 缺少 Microsoft.VisualBasic.PowerPacks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17133879/