Reputation: 1686
A web app that I'm writing throws this compiletime error
Error 1 The type or namespace name 'Web' does not exist in the namespace 'ATS.System' (are you missing an assembly reference?)
for every code file in the assembly the namespace is imported in every file (both System and System.Web)
I've also added references (to both) in the References Dir in VS
I don't know what I'm doing wrong
Upvotes: 0
Views: 1249
Reputation: 700342
You have a namespace "ATS.System" that is conflicting with the namespace "System". When the compiler sees "System.Web", it thinks that "System" refers to the "ATS.System" namespace.
Rename the ATS.System
namespace if possible, or use an alias for it. Something like:
using AtsSys = ATS.System;
Or:
Imports AtsSys = ATS.System
That would of course mean that you would have to put AtsSys.
before every class name that you use from that namespace.
Upvotes: 0
Reputation: 1500515
I suspect the problem is that you've got a namespace called ATS.System
- that's going to confuse things in some cases. If you possibly can, rename the namespace to something else.
Here's some example showing the same problem:
// Foo.cs
namespace ATS.System
{
class Foo {}
}
// Bar.cs
namespace ATS
{
using System.Collections.Generic;
class Bar {}
}
If you move the using directive out of the namespace declaration, i.e. change the second file to:
// Bar.cs
using System.Collections.Generic;
namespace ATS
{
class Bar {}
}
then it's okay - but I wonder whether the autogenerated code for ASP.NET puts the using directives inside the namespace declaration instead :( Getting rid of ATS.System
is certainly going to make it easier going forward though.
Upvotes: 1