Permalink
Browse files

Prevent plugin loading in the ReSharper test env

Fixes issue #7
  • Loading branch information...
1 parent 16723b7 commit d7f419edaedf89f7d467a084039400a0cbcaa4b3 @citizenmatt citizenmatt committed Dec 7, 2012
Showing with 10 additions and 2 deletions.
  1. +4 −1 src/resharper-nuget/NuGetApi.cs
  2. +6 −1 src/resharper-nuget/NuGetModuleReferencer.cs
@@ -18,6 +18,7 @@
using System.Collections.Generic;
using EnvDTE;
using JetBrains.Application;
+using JetBrains.Application.Components;
using JetBrains.ProjectModel;
using JetBrains.Threading;
using JetBrains.Util;
@@ -28,7 +29,9 @@
namespace JetBrains.ReSharper.Plugins.NuGet
{
- [ShellComponent]
+ // We depend on IComponentModel, which lives in a VS assembly, so tell ReSharper
+ // that we can only load as part of a VS addin
+ [ShellComponent(ProgramConfigurations.VS_ADDIN)]
public class NuGetApi
{
private readonly VSSolutionManager vsSolutionManager;
@@ -16,6 +16,7 @@
using System;
using System.Collections.Generic;
+using JetBrains.Application.Components;
using JetBrains.Application.Progress;
using JetBrains.ProjectModel;
using JetBrains.ProjectModel.Model2.Assemblies.Interfaces;
@@ -26,7 +27,11 @@
namespace JetBrains.ReSharper.Plugins.NuGet
{
- [ModuleReferencer(Priority = NuGetModuleReferencerPriority)]
+ // We need to tell ReSharper's component model that we can only run as a VS addin,
+ // because we depend on an object that depends on an interface that is only available
+ // in Visual Studio. In other words, If we rely on a component marked VS_ADDIN, we
+ // must also be marked VS_ADDIN
+ [ModuleReferencer(ProgramConfigurations = ProgramConfigurations.VS_ADDIN, Priority = NuGetModuleReferencerPriority)]
public class NuGetModuleReferencer : IModuleReferencer
{
// Must be greater than GenericModuleReferencer's priority

0 comments on commit d7f419e

Please sign in to comment.