I have an extension method like
public static class Extension
{
public static string GetTLD(this string str)
{
var host = new System.Uri(str).Hos
This is not a real solution and I can't explain how did it work but it worked.
I was trying everything in Project Properties, References, bin, obj but nothing helped me really. And I was just trying every option and chose 'Convert to Web Application' from the context menu. Although It was a Web Application itself before. It showed me a warning saying that .designer.cs
files will be added to each aspx file and I just clicked OK.
Everything remained same except App_Code
folder (where all these classes were) was renamed to Old App_Code
and I'd build the project. And now I am not getting compilation error at run time.
I know App_Code folder are meant to Website Project and I was having no issue with this till this time in WAP. But I just realize I should not have App_Code folder in WAP as it is discussed here in a wrox forum (1st point). Author has said here that
App_Code is not supported in a WAP. The App_Code folder is compiled at run-time; all code in a WAP is compiled at compile / development time. So, when you add an App_Code folder to a WAP. you end up with duplicate code; for example, a class defined in App_Code will also show up in the wap DLL. The fix is easy: just name the folder something else like Classes or CodeFiles.
I have tried it renaming too before conversion but that time it did not work.