The type MiniProfiler exists in both Miniprofiler.Shared and MiniProfiler
Asked Answered
S

1

6

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?

Smarm answered 8/10, 2017 at 9:47 Comment(2)
For anyone else finding this: it can also happen if you update MiniProfiler to v4 but not all packages. To resolve that, upgrade all packages to the same version.Larger
This happened to me when I tried upgrading MiniProfiler to version 4, and then rolled back to version 3. MiniProfiler.Shared was still in the /bin folder. Thank!Distracted
S
6

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.

Smarm answered 8/10, 2017 at 10:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.