87
Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.


Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\11.0\WebDev.WebServer40.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = TTLWIN2K\miralp
LOG: DisplayName = Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/SVN/temp/components/src/MasterpassProxy/src/Webservice/
LOG: Initial PrivatePath = C:\SVN\temp\components\src\MasterpassProxy\src\Webservice\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\SVN\temp\components\src\MasterpassProxy\src\Webservice\web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Mike Caron
  • 14,351
  • 4
  • 49
  • 77
Miral
  • 5,968
  • 16
  • 57
  • 85
  • The German message reads **Die Datei oder Assembly "Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.** (just in case someone is googling this). – Uwe Keim Dec 07 '18 at 07:46
  • 1
    The error happened to me in VS 2017, after I installed Visual Studio 2019 Preview. I managed to get rid of it by removing all traces to "Microsoft.VisualStudio.Web.PageInspector.Loader" from the global "web.config" files. I also pulled the content of "C:\Program Files (x86)\Microsoft Web Tools\Page Inspector" from another PC without Visual Studio 2019 and copied it back to my local PC. – Uwe Keim Dec 07 '18 at 07:48
  • I have faced the same issue Check this answer [answer ](https://stackoverflow.com/a/64484599/1053191) – Ashi Oct 22 '20 at 14:39

16 Answers16

193

I just ran into the same problem, and the culprit was my uninstalling of Visual Studio Express 2012. It's possible that it might be any version of Visual Studio, as comments on this answer are indicating the issue still happens with Visual Studio 2019. My overall order of operations was:

  • Installed Visual Studio Express 2012 (long time ago)
  • Used Visual Studio Express 2012 happily for many months
  • Installed Visual Studio 2013 Premium
  • Used Visual Studio 2013 Premium happily for weeks
  • Uninstalled Visual Studio Express 2012
  • ERROR

I'm not 100% certain on the cause of it, or what combinations of Visual Studio versions would exhibit this behavior. But the solution for me was to edit the root web.config files in the framework directories:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

(For different framework versions you may have different folders.)

And remove the nodes:

<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Be careful not to remove any opening/closing parent nodes which are also on the same line(s) as these.

This resolved the issue for me.

David
  • 208,112
  • 36
  • 198
  • 279
  • 13
    Your answer is correct. The reason why the error suddenly occurred is that uninstalling VS2012 will have removed the assembly `Microsoft.VisualStudio.Web.PageInspector.Loader` and the .NET Framework's `web.config` is still referencing it - even if it is simply to say "don't use this assembly" (ref: `` tag)!!! NOTE: Depending on what version of .NET you are targeting (2.0, 3.5, 4.0 and 32/64 bit) you may need to edit a number of web.config files under the `C:\Windows\Microsoft.NET\Framework[64]\[version]\Config\ ` path. – Chris Walsh Nov 27 '14 at 10:13
  • 2
    I got this error after uninstalling 2013 Express. And your solution worked for me. – tatigo Jan 21 '15 at 16:34
  • 5
    And I got this after uninstalling VS 2015 Community preview, and it also worked for me. – Yaron Levi Feb 14 '15 at 17:12
  • @ChrisWalsh I rolled your comment into the answer, since I had to remove the offending lines from multiple web.configs to fix the issue. – Mike Caron May 05 '15 at 15:50
  • I also got this error after uninstalling VS 2013 Community, and with this comment worked perfect for me – RicardoBalda Aug 24 '15 at 05:37
  • Got this after uninstalling VS 20xx (can't remember which) community and this fixed it. – Aarmora Oct 29 '15 at 15:40
  • 2
    i have this errors too - having VS2015 Pro installed and uninstalled VS2013 Pro; doing a repair of VS2015 Pro setup unfortunately did not fix the problem – toebens Nov 03 '15 at 15:11
  • I just got this issue after installing VS2015 Update 1. I can't find the actual dll except in caches from old builds. I presume update 1 removed it? – Dave Dec 08 '15 at 16:49
  • @ChrisWalsh: I got this error even before unistalling VS express 2013... I removed those lines so it worked – Jack Feb 07 '16 at 18:03
  • I got this after uninstalling vs2013 premium, had a few other weird issues, so repaired vs2015 and still got it. Fixed by editing the framework web.config – chillfire Sep 06 '16 at 08:06
  • We run on virtual desktops here. Shut down my VM, went to lunch. Came back and fired up my VM, and got this error after recompiling and running my app. This solution fixed my issue. – Ed DeGagne Mar 24 '17 at 19:42
  • I ran into this error because I got vs2015 installed initially and installed vs2017 then uninstalled vs2017. Removing these two lines from both locations fixed the problem. – Jason Aug 07 '17 at 18:39
  • 1
    A recent upgrade to Visual Studio 2017 v15.4.1 brought this up for me. – Brett Rigby Oct 30 '17 at 17:26
  • 1
    I just installed the latest update(as of date of this comment: 15.9.4) for Visual Studio 2017 and encountered this issue, removing those lines of code worked great. Thanks! – dh6984 Dec 11 '18 at 23:10
  • 5
    @wiero: Me. Happened after installing VS 2019 Preview side-by-side with VS 2017 Community. FWIW, solution was to remove line `` from `C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config` – dpant Dec 29 '18 at 21:12
  • 2
    With Visual Studio 2019, the closing `` tag is on the same line as the `PageInspector` reference. **Make sure you don't delete it by accident**, move it to the next line before deleting the reference! – Mahmoud Al-Qudsi Feb 18 '19 at 02:04
  • Thanks a ton, this solution works well with VS 2019 as well – cuongle Apr 03 '19 at 12:18
  • after removing the testcases dont run at all and show build error even if there arent any microsoft DEv sucks – kunal verma Jun 19 '19 at 06:10
  • I have faced the same issue Check this answer [answer ](https://stackoverflow.com/a/64484599/1053191) – Ashi Oct 22 '20 at 14:38
22

No need to remove those lines
Just close and reopen the Visual studio with Admin privileges.

user6228795
  • 245
  • 2
  • 4
  • 3
    I run visual studio in admin mode all the time but it still did not work. removing those lines as david / mike suggested did the trick. – Adrian Hedley Feb 08 '17 at 11:37
  • This worked for me, however the replacing the lines (accepted answer) didn't work (it just threw out an error saying a different assembly as missing). It appears people here all have different problems, all to do with assembly references.. but all the problems appear slightly different and therefore would have slightly different solutions. – Josh Harris Jul 10 '18 at 09:28
17

I got the same problem but not on my development machine but on hosting server.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

I was able to fix it by adding below code to my web.config

<compilation targetFramework="4.5"> 
    <assemblies> 
        <remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </assemblies> 
</compilation>

or by removing reference to this assembly from web.config files in framework directories.

I never installed VS there and i never had PageInspector installed there. Any idea why those configs reference them?

Pawel
  • 887
  • 1
  • 9
  • 28
  • 3
    I started getting this error after installing VS 2019 Preview, and this solution worked for me. – FishBasketGordo Dec 10 '18 at 22:46
  • I've added the section and it worked OK on my dev machine. But after deployment on test servers it returned error, that assembly "Microsoft.VisualStudio.Web.PageInspector.Loader" not found. – Michael Freidgeim Aug 20 '19 at 02:58
  • Thanks - this fixed it for me (I tried restarted VS as admin but didn't fix it). – Christopher Jan 30 '20 at 17:31
  • Just to clarify - I got this annoying error in a new/blank project but this same fix didn't immediately resolve the issue. I had to fuss with it (restarting VS as admin, trying a few other and module lines from the answers/comments in this thread, etc) and it eventually went away. Super annoying. – Christopher Feb 03 '20 at 19:18
6

Update: fixed in Visual Studio 2019 Version 16.0.3 according to this page.

If this happens after upgrading to Visual Studio 2019 RC, the following workaround helped:

  1. Find the download cache directory enter image description here
  2. Use Explorer or better to find the AspNetDiagnosticPack.msi within this directory.
  3. Run (double-click) the AspNetDiagnosticPack.msi file (this will force the installation of this MSI).

Workaround found here

Bernard Vander Beken
  • 4,848
  • 5
  • 54
  • 76
3

I had this issue after installing Visual Studio 2019 (whilst 2017 was still installed). It's caused by a missing component - AspNetDiagnosticPack.msi - that fails to install a required package into C:\ProgramData\Microsoft\VisualStudio\Packages\

The solution that worked for me was this:

  • Close Visual Studio

  • Download the package from:

https://download.visualstudio.microsoft.com/download/pr/e13d544f-5a3c-4bb3-9a7c-1e56b1f90e10/f8e5888ff01a7009ef8c2ef16aa02ab9/aspnetdiagnosticpack.msi

  • Run the installer and install.

This should fix it.

More information can be be found: https://developercommunity.visualstudio.com/content/problem/398640/could-not-load-file-or-assembly-microsoftvisualstu-7.html

Dan Diplo
  • 25,076
  • 4
  • 67
  • 89
2

For those who might end up here, try removing the following line in the Web.Config file of your Project while debugging <identity impersonate="true" userName="blah" password="blah">

It took time until I finally came across the following thread: Could not load file or assembly or one of its dependencies. Access is denied. The issue is random, but after it happens once, it continues

Community
  • 1
  • 1
usefulBee
  • 9,250
  • 10
  • 51
  • 89
2

I've ran into this error while trying to run an ASP.NET project in VS2013 after having uninstalled a VS2015 preview. Repairing the VS2013 installation seems to have solved the problem.

apk
  • 1,550
  • 1
  • 20
  • 28
1

I got this answer is perfect for me

No need to remove those lines

Just close and reopen the Visual studio with Admin privileges.

0

I removed the dll from gac and it started working. I am not sure where those dlls came from. If you have 2 or more versions of visual studio, reinstall the last version.

Robby Cornelissen
  • 91,784
  • 22
  • 134
  • 156
Miral
  • 5,968
  • 16
  • 57
  • 85
0

Try updating your Microsoft.ApplicationInsights nuget package. This also installs other dependencies. I ran into this problem when I had to change my Target Framework.

  1. Tools > NuGet Package Manager > Manage NuGet Packages for Solution...
  2. search for "applicationinsights"

or run

Install-Package Microsoft.ApplicationInsights
Michael Freidgeim
  • 26,542
  • 16
  • 152
  • 170
Chuck Rostance
  • 6,976
  • 2
  • 25
  • 17
0

Had a similar problem (another assembly) and for me it was a missing line in the web.config on the machine. A line that I think lets the web server load (any?) dll. I had to add "*" to the compilation-assemblies list in the web.config:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

Like this

    <compilation>
      <assemblies>
        ...
        <add assembly="*" />
      </assemblies>
    </compilation>

To find it I had to compare the file with one from a working server. So it seems to me that It really is a load failure, but to determine why it fails, we need to be Sherlook H.. Normally I use a tool like ProcessMonitor to find out why I get a Load Failure, but this time, of course, it gave me no useful output.. IIS never tried to load the assembly!

LarsN
  • 1
0

If you don't see web.config in both of paths: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

file "Web" is in "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\" what I really want to show you, It's Web.config, you should open it with: notepad++... and remove:

//<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />"

I finish my problem with them.

Michael Freidgeim
  • 26,542
  • 16
  • 152
  • 170
CuongKid
  • 1
  • 1
0

Our project had (incorrectly) reference to the PageInspector.Loader.dll in the GAC for a long time:

 <ItemGroup>
    <Reference Include="Microsoft.VisualStudio.Web.PageInspector.Loader">
      <HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Web.PageInspector.Loader\v4.0_1.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Web.PageInspector.Loader.dll</HintPath>
    </Reference>
  </ItemGroup>

It worked for some time, but recently deployment to Azure caused the error "Can not find compilation library location for package Microsoft.VisualStudio.Web.PageInspector.Loader".

We found and deleted the reference from .csproj file and the problem was fixed.

Michael Freidgeim
  • 26,542
  • 16
  • 152
  • 170
0

I opened today a 10 year old project and encounter this issue in VS 2019 (16.9.1), in my case it was

<trust level="Medium"/>

removing above line from the web.config or setting <trust level="Full"/> solved this issue.

Morbia
  • 4,144
  • 3
  • 21
  • 13
0

I know this is an old one but I ran into this error when debugging with Visual Studio 2010 (I also run 2013, 2017 and 2019 on the same machine...I have a few legacy apps :oP). In my case, I debug using local IIS as webserver (not express) and I ended up having to recycle the websites Application Pool which did the trick to clear the error (after restarting 2010). Dave

Dharman
  • 30,962
  • 25
  • 85
  • 135
Dave
  • 740
  • 1
  • 6
  • 17
-4

it solved the problem on at my end by applying the approved solution in this thread.

modifying the following two files, and removing Microsoft.VisualStudio.Web.PageInspector.Loader resolved the issue.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
Vojtech Ruzicka
  • 16,384
  • 15
  • 63
  • 66