Question

I am using VS2012 Update 3 and have a solution containing three visual basic projects a class library, a conosole app, and an IIS website.

The website has a reference to the library project. The library compiles fine and automatically places the latest dll in the bin folder of the website.

This was all working without issue before this week.

My web pages are able to import and use the class library. I get proper intellisense and the pages browse or eventually browse showing they are using the library. This week sometimes I get a type not defined error with browsing but after waiting it works. But the compile is always a fail now.

When compiling sometimes the errors show in the error list then eventually disappear but at ALL times when building the errors show up in the output tab as: SomeCodeBehindFile.aspx.vb(#,#) error BC30002: Type 'SomeTypeInMyLibrary' is not defined.

Error BC30002 - Type XXX is not defined did not help. I tried using fully qualified variable types versus using the import. I tried changing the identity on the app pool to Network Service which has read permission on the whole site.

I've also tried Visual Studio's build > Clean Solution and deleting all files from windows' framework Temporary ASP.NET Files.

The only thing I may have done to irritate VS would have been renaming one of my asp files and its class names/page directive attributes manually but I have done this before without issue. I got paranoid and deleted that file and re-added it also. I also have 3 pages complaining about types not being defined now.

Was it helpful?

Solution

Was really perplexed for awhile. It also got worse with the pages using the library permanently refusing to browse. Though if I copied the library and erroring pages in another web app it would work! Not knowing what went off the rails I started a fresh VB web site and was back in business for awhile but then it started again. I did not connect what I did that actually caused the grief in my 2nd site. For a 3rd time I started a fresh web site this time using C#. Going great again up until that point I kept shooting myself. Thankfully the C# compiler gave a more helpful error message: "A using namespace directive can only be applied to namespaces; 'StaffPlusLibrary' is a type not a namespace". Grrr the problem was I kept adding a help page to the site related to the class library and called the page StaffPlusLibrary.aspx. I am careful not to name pages the same as existing classes but it did not register in my mind I was about to create a page using the same name as my library's root namespace. So the page created a class using the same name as the namespace. The ambiguity I introduced was not apparent until C#.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top