如何开发 Visual Studio 插件?
我有一个模糊的想法,Visual Studio 允许您运行第二个沙盒实例,其中实际上正在加载加载项。这将允许您调试您的加载项代码等。
这实际上可能吗?我该怎么做呢?
我当前使用的是 Visual Studio 的单个实例。我遇到的问题是,当我加载并运行加载项时,它不允许我再次编译,直到我重新启动该 Visual Studio 实例,因为似乎无法卸载加载项。即使使用 Visual Studio 的两个实例也无济于事。一定有更简单的方法,请问大家是怎么做的?
谢谢
I have a vague idea Visual Studio allows you to run a second sandboxed instance where the add-in is being in fact loaded. That'd allow you to debug your add-in code and such.
Is this effectively possible? How would I go about doing that?
I'm currently using a single instance of Visual Studio. I'm having the problem that as I load and run the add-in, it won't allow me to compile again until I restart that instance of Visual Studio as there seems to be no way to unload the add-in. Even using two instances of Visual Studio wouldn't really help in here. There must be an easier way, how do you guys do it?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议下载适用于您正在使用的 VS 版本的 Visual Studio SDK,即 VS2010。
您所需要做的就是在实验配置单元中运行 VS 的第二个实例。有一个命令行开关根后缀,它采用一个参数 - 实验配置单元的名称(通常为 Exp)。如果您使用此键启动 VS,它将通过克隆标准 VS 配置单元中所需的任何内容,在注册表中创建一个单独的配置单元。
您可以在实验配置单元中注册/添加您的插件/软件包/任何内容,而您的主力配置单元 - 主配置单元保持干净且不受影响。
即使您忽略了锁定 dll 带来的头痛,这也是一个好主意。有一件事是,把注册表弄乱并不难——所以 VS 甚至无法启动。您不希望您的主蜂巢发生这种情况。如果实验发生了这样的情况 - 好吧 - 你总是可以重新创建它 - SDK 中包含一个实用程序
I would recommend to download Visual Studio SDK for the VS version you are using i.e. VS2010.
All you need is to run the second instance of VS in the experimental hive. There is a command line switch rootsuffix which takes one parameter - the name of the experimental hive (usually Exp). If you start VS with this key it will create a separate hive in the registry by cloning whatever is necessary from the standard VS hive.
You can register/add your plugins/packages/whatever in the experimental hive, while your workhorse - main hive remains clean and unaffected
This is a good idea even if you ignore your headache with the locked dlls. One thing it is not too difficult to mess up the registry really bad - so VS wont even start. You do not want this to happen with your main hive. And if ti happens with the experimental - well - you can always recreate it - there is a utility for that included in the SDK
一个有用的提示:您可以按住 禁用所有加载项VS启动时左移键。您可以为“调试器”实例执行此操作,并让加载项加载到“被调试者”实例中。
One useful tip: you can disable all add-ins by holding down the left-shift key when VS starts. You can do this for your "debugger" instance and let the add-in load in the "debugee" instance.
在我看来,查找有关此主题的信息很难。有很多“Hello World”类型的示例,但大多数都是信息不足、具有误导性、不完整或过时的。更不用说整个体系结构与大多数人可能习惯的托管代码开发不同,因为 COM 至少涉及其中一种开发方法(有多种)。
Professional Visual Studio 2010 有一个简短的入门指南,应该可以为您指明正确的方向。
还有专业 Visual Studio 可扩展性(从 2008 年开始)可能有点已经过时了,但据我了解,大多数主要概念仍然适用。
希望有帮助。
In my opinion, finding information on this topic is hard. There are a lot of "Hello World" type examples, but most of them are uninformative, misleading, incomplete or outdated. Not to mention the fact that the whole architecture is different from what most people might be used to with managed code development since COM is involved with at least with one of the development methods (there are multiple).
Professional Visual Studio 2010 has a brief primer that should point you in the right direction.
There is also Professional Visual Studio Extensisbility (from 2008) that might be a little outdated, but from what I understand most of the major concepts still apply.
Hope that helps.