4

I'm trying to read up on asp.net mvc, I have never used asp.net before but are familiar with regular c# development.

Freshly installed, fully patched Windows XP Home.
Freshly installed updated to SP1 Visual Studio 2008 Pro.

Started a new project, selected "ASP.NET MVC Web Application", target framework is 3.5

I hit F5 and I get:
"Could not load file or assembly System.EnterpriseServices"

Exact wording in swedish:

[FileNotFoundException: Det går inte att hitta filen. (Undantag från HRESULT: 0x80070002)]
[FileNotFoundException: Det går inte att läsa in filen eller sammansättningen System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a eller ett av dess beroenden. Det går inte att hitta filen.]

Adding a reference to System.EnterpriseServices in my project did not work.
A quick google suggested I copy this file Microsoft.NET/Framework/v2.0.50727/System.EnterpriseServices.dll into %WINDOWS%/assembly but that did not work either.

Any suggestions?

Found the answer, I added it to the GAC with gacutil.

C:\WINDOWS>"C:\Program\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" /i Microsoft.NET/Framework/v2.0.50727/System.EnterpriseServices.dll

1
  • Note that the command is run in C:\Windows (because the DLL is in C:\Windows\Microsoft.NET\Framework\....") and that the gacutil.exe should be the bin folder of whichever version of the Microsoft platform SDK you have installed. Mar 18, 2010 at 21:18

3 Answers 3

6

Found the answer, I added it to the GAC with gacutil.

C:\WINDOWS>"C:\Program\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" /i Microsoft.NET/Framework/v2.0.50727/System.EnterpriseServices.dll

1
  • 1
    Worked for me when I suddenly started getting Could not load file or assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest. None of the other solutions worked except for this one. Thanx man!
    – Van Dame
    May 24, 2013 at 3:46
2

Some time the solution Nifle given is working but some time it didn't solve the issue. When you try to compile your project it give you this message without re-compiling. One of the solution is to clear the temporary asp.net files. The following are the possible path. But it depend on your project framework version. In asp.net temporary folder find folder that matches your project folder name.

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles

OR Replace the version you are using

C:\WINDOWS\Microsoft.NET\Framework\<Framework Version>\ASP.NETWebAdminFiles
1

Got this error in 2023 while using Blazor. The fix for me is to Enable Just My Code in Visual Studio. (By the way, I had to do it 2x because somehow the first time I did it, it didn't save the setting. )

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.