I have a piece of code like this:
public class NoFollowWebClient : WebClient
{
protected override WebRequest GetWebRequest(Uri address)
{
var request = (HttpWebRequest)base.GetWebRequest(address);
request.AllowAutoRedirect = false;
return request;
}
}
Whenever I add this to a .cs file though, Visual Studio 2012, in it's infinite wisdom, converts my C# source file to a "design time component". So, when I double click on the file now, instead of seeing my C# code, I see "To add components to your class, drag them from the Toolbox and use the Properties window to set their properties".
I know I can right click and do "view code", but that's extremely annoying.
Is there anyway to force Visual Studio to not assume I'm making a component or that I care about their stupid visual designer that serves no purpose for my class?
csproj
file XML. Make sure it's marked as a<Compile Include="....\NoFollowWebClient.cs" />
kind of entry. EDIT: Perhaps it's marked as a completely different kind of file; make sure it doesn't have a<SubType>Designer</SubType>
child tag under it.