使用Microsoft Composition MEF2的带有便携式类库的MEF抛出未找到文件的异常 [英] MEF With Portable Class library using Microsoft Composition MEF2 throws file not found exception

查看:115
本文介绍了使用Microsoft Composition MEF2的带有便携式类库的MEF抛出未找到文件的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究可移植类库(PCL),并试图在其中实现MEF.我使用了Nuget的System.Composition.当我为vsix(Visual Studio扩展)构建和打包时,它不会打包这些dll并将其放置到扩展文件夹中 (C:\ Users \ UserName \ AppData \ Local \ Microsoft \ VisualStudio \ 14.0Exp \ Extensions \ ExtensionName \ AppName \ versionofYourApp).当我手动将那些库放置在此文件夹中时,它可以正常工作.有人可以为这个问题提供一个好的解决方案.我正在为Roslyn Analyzers编写它并创建一个nuget包.即使我将那些库打包在一起,我仍然面临着同样的问题.

I am working on Portable Class Library(PCL) and trying to achieve MEF in that. I used System.Composition from Nuget. When i build and package for vsix (Extension for Visual Studio) it doesn't package and place those dll's to extension folder (C:\Users\UserName\AppData\Local\Microsoft\VisualStudio\14.0Exp\Extensions\ExtensionName\AppName\versionofYourApp). When i manually place those library in this folder it works fine. Can some one suggest a good solution to this problem. I am writing it for Roslyn Analyzers and creating a nuget package. Again i am facing the same issue, even if i am packaging those library together.

推荐答案

我找到了一个共享解决方案.欢迎您纠正和提出建议.对于Vsix扩展,我将这些库从本地添加为资产(VisualStudio.Assembly).

I found a solution, thought of sharing. You are welcome to correct and suggest. For Vsix extension i added those library as an asset(VisualStudio.Assembly) from local.

对于包,Assembly.Load("AssemblyName")试图从所有可能的位置加载库,例如"C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ PrivateAssemblies"等等.所以我把它放在那里,它正在被加载.我知道这不是最好的解决方案.欢迎您提出建议.

And for packages, Assembly.Load("AssemblyName") was trying to load library from all possible locations like " C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies" and many. So i placed it there and it was getting loaded. I know this is not the best solution. You are most welcome to suggest.

这篇关于使用Microsoft Composition MEF2的带有便携式类库的MEF抛出未找到文件的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆