如何在 Visual Studio 扩展 (vsix) 中包含 Nuget 包 [英] How to include a Nuget package in a Visual Studio Extension (vsix)

查看:67
本文介绍了如何在 Visual Studio 扩展 (vsix) 中包含 Nuget 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 Visual Studio 扩展 (VSIX),它使用 Roslyn 更改我们的应用程序代码.

VSIX 解决方案包括 NUGET 包 Microsoft.CodeAnalysis.Analyzers.顺便说一句,它被描述为版本 1.3.2,但底层 DLL(例如Microsoft.CodeAnalysis.CSharp.dll")都报告为 1.3.2.

无论如何,我把它放在我们当地的私人画廊.从那里,我可以将它添加到 Visual Studio(VS2015 更新 3)并按预期执行.

然而,在我的同事将它添加到他们的 Visual Studio (VS2015 Update 3) 并尝试执行后,他们收到以下消息:

<块引用><小时>

微软 Visual Studio

无法加载文件或程序集Microsoft.VisualStudio.LanguageServices, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"或其依赖项之一.系统找不到指定的文件.

好的

当我查看 VSIX 存档时,我确实看到了许多 DLL,但这些是我的 DLL"以及所有带有前缀系统"的 DLL.我没有看到任何前缀为Microsoft.".我确实尝试将 BIN 文件夹中的每个 DLL 手动复制到 VSIX,看看它是否会产生任何影响,但没有成功.

所有引用的 DLL 似乎都有本地复制",因此它们在我的 BIN 中,但在最终用户的计算机上无法访问.

我看到清单可以同时包含资产"和依赖项",但尚不清楚这些是否可用于 NUGET 包.

我错过了什么?

解决方案

最终找到了答案:

带有项目模板和 NuGet 包的 VSIX

  • 请参阅 Min(2013 年 8 月 28 日)关于他的 YouTube 视频的回答
  • 并注意 KyleMit 对这在相当长的视频中出现的位置的评论.

修复过程相当冗长,因此最好在他的视频中呈现.

I have created a Visual Studio Extension (VSIX) that makes changes to our Application's code using Roslyn.

The VSIX solution includes the NUGET package Microsoft.CodeAnalysis.Analyzers. As an aside, it is described as version 1.3.2, but the underlying DLLs (e.g. "Microsoft.CodeAnalysis.CSharp.dll") all report to be 1.3.2.

Anyhow, I put this on our local private Gallery. From there, I can add it to Visual Studio (VS2015 Update 3) and it executes as expected.

However, after my colleagues add it to their Visual Studio (VS2015 Update 3) and attempt to execute it, they receive the following message:


Microsoft Visual Studio

Could not load file or assembly 'Microsoft.VisualStudio.LanguageServices, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

OK

When I look in the VSIX archive, I do see many DLLs, but these are "my DLL" and all those with the prefix "System.". I'm not seeing any with the prefix "Microsoft.". I did try manually copying every DLL that I have in my BIN folder to the VSIX to see if it would make any difference, but with no success.

All DLL referenced appear to have "copy local" on them, so they're in my BIN, but they're just not accessible on the end users' machines.

I see the manifest can include both "Assets" and "Dependencies", but it's not immediately clear if these can be used for NUGET packages.

What am I missing?

解决方案

Eventually found the answer:

VSIX with Project Templates and NuGet Packages

  • See the answer from Min (Aug 28 '13) regarding his YouTube video
  • And take note of KyleMit's comment regarding where in the rather lengthy video this appears.

The fix is rather lengthy, so best presented in his video.

这篇关于如何在 Visual Studio 扩展 (vsix) 中包含 Nuget 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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