Having an issue where compiling some code that makes use of HttpContextBase
is throwing the compile error:
UserService.cs(13,26): error CS0433: The imported type `System.Web.HttpContextBase' is defined multiple times
The offending line is:
private readonly HttpContextBase httpContext;
If I take that line of code out, or comment it, the error goes away and the assembly compiles.
In another project (the test project for this one) the same error occurs when trying to declare a HttpContextBase
to pass to the constructor of this object. So it appears to be a cross-project issue.
Is this a project file issue? (Can't find more than one reference to System.Web
in there). It was compiling before I made some changes to the AfterBuild
step, so I'm concerned I've messed something up in the csproj file.
This is building with Mono 2.10.1, using monodevelop trunk build set to use xbuild to compile.
Compiling using the default Monodevelop build behaviour does not produce this error.
Tthe type System.Web.HttpContextBase was defined in System.Web.Abstractions.dll in .NET 3.5 SP1, but in System.Web.dll in .NET 4.0. That means that compiled dlls with references to the type in System.Web.Abstractions.dll would be "type forwarded" to System.Web.dll.
You seem to have a local copy of System.Web.Abstractions.dll in /Users/shimms/Development/convergence/lib/System.Web.Abstractions.dll, probably the .NET 3.5 version, which would conflict with the 4.0 System.Web.dll.