Search code examples
c#asp.net-mvcminiprofiler

The type MiniProfiler exists in both Miniprofiler.Shared and MiniProfiler


I am trying to use the stack exchange MiniProfiler in my asp MVC project, but getting a really annoying error message in my view, where I am calling

@using StackExchange.Profiling

and

@MiniProfiler.RenderIncludes()

on the RenderIncludes line, VS complains that

The type 'MiniProfiler' exists in both 'MiniProfiler.Shared, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3' and 'MiniProfiler, Version=3.2.0.157, Culture=neutral, PublicKeyToken=b44f9351044011a3'

I already checked the (.csprroj) project file, and it only contains one element referencing MiniProfiler:

<Reference Include="MiniProfiler, Version=3.2.0.157, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
  <HintPath>..\packages\MiniProfiler.3.2.0.157\lib\net40\MiniProfiler.dll</HintPath>
</Reference>

I also checked in packages.config and it also only has 1 reference to MiniProfiler:

<package id="MiniProfiler" version="3.2.0.157" targetFramework="net452" />

I cleaned the project and restarted Visual Studio but with no success. What is happening here?


Solution

  • So I manageed to find the cause of this when I double-clicked on MiniProfiler under References in the solution explorer.

    This opens up an object explorer in the main window, which was displaying some references which were not visible in the solution explorer (how annoying), including MiniProfiler.Shared.

    So I checked the path for these, and they were in the bin folder. After physically deleting the files, my error went away.