10

问题说明了一切。我正在尝试编写一个 Visual Studio 插件(2012 年),并且实验实例总是启动而不在插件中运行任何东西。主实例中没有断点,实验实例也没有加载插件。

我应该指出:它曾经在某个时间工作过一次或两次,然后我删除了该项目,因为我认为它是错误的项目,但最终以相同的名称重新创建它。

再多的摆弄“允许加载插件”重置实验实例手动清理注册表都无法解决问题。我也尝试寻找我的插件 dll,但它不在列表中。我完全没有想法和可能的搜索词。有什么建议么?

4

5 回答 5

3

我遇到了和你一样的问题,刚刚为我找到了修复,它与提供的加载项项目中的新“文件属性”条目有关。

如果你打开这个在我的例子中名为“[App Name] - For Testing.AddIn”的文件,你会看到包含诸如 AddIn 友好名称、描述等内容的 XML 标记

对我来说,我发现我立即重命名了我的项目的输出程序集,这不再匹配在此属性文件中找到的内容:

<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">
<HostApplication>
    <Name>Microsoft Visual Studio</Name>
    <Version>11.0</Version>
</HostApplication>
<Addin>
    <FriendlyName>My Addin</FriendlyName>
    <Description>My Addin description.</Description>
    **<Assembly>E:\Workspaces\Scratch\MyApp\bin\MyApp.VisualStudio.Addin.dll</Assembly>
    <FullClassName>MyApp.VisualStudio.Addin.Connect</FullClassName>**
    <LoadBehavior>1</LoadBehavior>
    <CommandPreload>1</CommandPreload>
    <CommandLineSafe>0</CommandLineSafe>
</Addin>

我检查了程序集的名称和类名,修复了它们,保存文件并点击调试,一切又开始工作了!希望这可以帮助...

于 2013-04-04T14:09:05.360 回答
1

I had a similar problem... fought with it for quite a while, and eventually, absolutely randomly experimented with adding other configurations to the project (Configuration Manager) and also changing the framework.

One of the two magically helped. (I think it may have been the framework... though it makes no sense).

I am not saying that the same thing will work for you.

The random experiment was not really random: I got hold of a "debuggable" add-in off the web, and compared every single item in the project, solution and all other files, to find what could be different. This is my true suggestion.

If all else fails, you can also try to manually attach the debugger, see if you can make headway this way. [ that did not work for me, but it may provide valuable information, and... not all bugs are created the same. ]

于 2013-02-12T04:42:02.413 回答
1

我有同样的问题。调试一直有效,直到我关闭了 Visual Studio 的所有实例。然后我再次打开 Visual Studio,它说我一直在调试的加载项已经停止工作。当 Visual Studio 询问是否要删除它时,我说是的。

显然,删除此射线中的加载项会将“[AppName] - For Testing.AddIn”文件重命名为附加下划线。

要解决此问题,请进入加载项解决方案并查看“[AppName] - For Testing.AddIn”文件中的属性。转到文件所在的文件夹。在文件系统中重命名此文件以匹配 Visual Studio 中的文件名。

于 2013-10-08T04:06:52.250 回答
1

似乎这个问题有不同的解决方案,但这最终帮助了我:

  1. 在 AddIn 文件中更改<LoadBehavior>1</LoadBehavior><LoadBehavior>0</LoadBehavior>并手动将其放入C:\Users[UserName]\Documents\Visual Studio 2012\Addins
  2. 重新启动 Visual Studio(我使用 2012)

完整的插件文件:

<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">
    <HostApplication>
        <Name>Microsoft Visual Studio</Name>
        <Version>11.0</Version>
    </HostApplication>
    <Addin>
        <FriendlyName>[Friendly Assembly Name]</FriendlyName>
        <Description>[Description of the Addin]</Description>
        <AboutBoxDetails>[About details]</AboutBoxDetails>
        <Assembly>[Full path to the binary e.g. C:\Test\debug\test.dll]</Assembly>
        <FullClassName>Test.Connect</FullClassName>
        <LoadBehavior>0</LoadBehavior>
        <CommandPreload>1</CommandPreload>
        <CommandLineSafe>0</CommandLineSafe>
    </Addin>
</Extensibility>

在我的情况下,我转移到另一台开发人员机器上,它以前在旧机器上工作,但在新机器上我没有任何“[Assembly Name] - For Testing.AddIn”,因为我没有费心检查它在。我认为 LoadBehavior 是For Testing和常规 AddIn之间的区别。

于 2013-06-06T00:01:26.120 回答
0

就我而言,Resharper 是原因。禁用 Resharper 后一切恢复正常。

于 2014-01-19T16:15:17.827 回答