vsix dll缺失问题

本文介绍了一款针对VS2015开发的代码可视化插件,在VS2010/2012/2013等低版本环境下无法正常运行的问题及解决方法。通过在插件中包含特定DLL文件,确保了插件能够在不同版本的Visual Studio环境中成功加载。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

自己在vs2015做的代码可视化插件在只装了vs2010/2012/2013的机器打不开。
报了这个错:

未能加载文件或程序集“Microsoft.VisualStudio.Shell.14.0, Version= 14.0.0.0 , Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。系统找不到指定的文件

检查发现是依赖了两个只有vs2015有的dll,分别是
Microsoft.VisualStudio.Shell.14.0.dll
Microsoft.VisualStudio.Shell.Immutable.14.0.dll

只要将这两个dll复制入vs低版本的   \Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies  类似目录中,整个插件就可以加载。

于是希望插件发布时能够安装这两个dll。

后来发现,所谓vsix不过是一个zip压缩包,vs插件安装过程只不过是把里面的内容解压到 C:\Users\me\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\xxxx(插件相关的一个字符串)\ 里面,如图
511610-20170722000857980-1834495928.png
 在这里我有几点发现
1.文件原封不动来自debug目录
2.工程依赖的其他工程的dll被复制过来,说明运行时系统是可以发现到这个文件夹内部的dll并加载之的
3.resource目录下是一个我自己添加的图片资源,说明自己添加的资源也会被原封不动复制过来

于是,解决方案就是自己添加缺失的dll作为资源,于是vsix安装过后在这个文件夹就会有那些dll,运行时这些dll也会被加载

具体操作如下
1. 工程下点add ->existing item, 添加dll
511610-20170722000901792-1654730723.png
 2. dll属性页,将include in vsix设成True
511610-20170722000904605-299215433.png
 

编译过后,vsix里面就有dll了
 




转载于:https://www.cnblogs.com/dydx/p/7220121.html

<type>Error</type> <source>VisualStudio</source> <description>CreateInstance failed for package [Vsix]Source: &apos;mscorlib&apos; Description: 未能加载文件程序集“file:///C:\Users\xujia\AppData\Local\Microsoft\VisualStudio\15.0_f82e29e3\Extensions\be1ppt2o.esi\QtVsTools.dll它的某一个依赖项。系统找不到指定的文件。 System.IO.FileNotFoundException: 未能加载文件程序集“file:///C:\Users\xujia\AppData\Local\Microsoft\VisualStudio\15.0_f82e29e3\Extensions\be1ppt2o.esi\QtVsTools.dll它的某一个依赖项。系统找不到指定的文件文件名:“file:///C:\Users\xujia\AppData\Local\Microsoft\VisualStudio\15.0_f82e29e3\Extensions\be1ppt2o.esi\QtVsTools.dll” 在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 在 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 在 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 在 System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) 在 System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence) 在 System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) 在 System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName) 警告: 程序集绑定日志记录被关闭。 要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD)设置为 1。 注意: 会有一些与程序集绑定失败日志记录关联的性能损失。 要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。 </description> <guid>{15021976-647E-4876-9040-2507AFDE45D2}</guid> <hr>80004005 - E_FAIL</hr>
06-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值