CS0234 Error on runtime, for classes in the same assembly
We have an ASP.NET 4 Web A开发者_运维技巧pplication Project. This project contains a number of pages. After having made some changes I get an error at runtime (ASP.NET Compile time) that this or that namespace cannot be found.
At design time (in Visual Studio 2010) there is no problem for Intellisense to see these namespaces and classes, which are in the project assembly themselves. And there is no problems at compile time in Visual Studio either.
Check out the answer I received for a very similar question and see if this does the trick for you (it did for me!):
.Net Extension Method (this string Foo) Only Partially Visible
This will be a page compilation error. The reason it works fine at design/compile time is because page compilation does not happen then...it happens at runtime.
You need to look into the compilation.assemblies
configuration and pages.namespaces
, which let you configure the assemblies and namespaces used in the generated code for pages. The other way to ensure assemblies are referenced during page compilation is to mark them as "Copy Local" in your solution.
精彩评论