I transferred my project into another computer from Win XP to Win 7. After installation, I realized that something in my App_code folder, called like mydata.web.utils namespace, has a class called like WebConstants (which is public class and public functions).
now in areas like global.asax, it tells me "WebConstants does not exist in this context"
Even though I have:
<%@ Import Namespace="mydata.web.utils" %>
And webconstants.cs has:
namespace mydata.web.utils
{
public class WebConstants
{
public static String APPLICATION_VERSION = "version";
........
}
}
No syntax errors or compiler errors in webconstants.cs
But everywhere else, it's saying "what is 'web'"??
If I rename the namespace from "web.utils" to just "web", still same problem. If I rename "web.utils" to "wez"--then the compiler errors go away.
But I cannot do this, because then I'd have to change it all over the project, which is a ton of work.
I also notice in the "build output" that there is no App_code being compiled in the project. Maybe because it's an ASP.net folder, I'm not certain. Is that normal?
How is it that the same source code, same visual studio, produces errors in win7 and no errors in the winXP computer?
Right click on the webcontants.cs file and go to Properties. Check to be sure 'Build Action' is set to 'Compile'. It may be set to 'Content', in which case VS wouldn't pick it up.
If you have this namespace in a different project, make sure you are adding the reference to the web project as well.
Also, make sure that the project where the namespace "mydata.web.utils" is coming from, is being build properly.
You can also change the level of the details in your "output" window in Visual Studio, after the build fails: (Tools->Options->Project and Solutions->Build and Run, selecting “Normal”, in order to see more details). You can get more details on this from my blog on this: Error “ILMerge.Merge: The target assembly ‘blabla.blabla’ lists itself as an external reference” building a setup project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With