简体   繁体   中英

Microsoft.Web.Administration (for IIS7 automation) doesn't work in VS 2010

I'm trying to experiment with Microsoft.Web.Administration on my Windows 7 x64 box, using Visual Studio 2010. When I add the DLL to references in my C# project, I can see its namespaces and classes pop up in Intellisense.

But as soon as I build, I get "The type or namespace name 'Web' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)", and I get build errors in the code I've written, as if the DLLs aren't even there.

There are two sets of IIS7 DLLs that I can see, in:

  • %windir%\\system32\\inetsrv
  • %windir%\\syswow64\\inetsrv

But both sets seem to do the same thing: Apparently initially work, then fail on build.

Does anyone know what I need to do to get this working?

If this is a .NET 3.5 or .NET 4.0 project, open the project properties. On the Application tab it will have probably defaulted to either of:

  • .NET Framework 3.5 Client Profile
  • .NET Framework 4 Client Profile

Change this to .NET Framework 3.5 or .NET Framework 4. Your project should then build just fine.

As the compiler error points out, Microsoft.Web.Administration has a dependency on System.Web which isn't referenced in the 3.5/4.0 client profiles.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM