Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 interprets my file as a form file

I create simple cs file with one class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace Bed
{
    public class TimeoutWebClient : WebClient
    {
        protected override WebRequest GetWebRequest(Uri uri)
        {
            WebRequest w = base.GetWebRequest(uri);
            w.Timeout = 30 * 1000;
            return w;
        }
    }
}

suddenly my visual studio has interpreted it as a form class.. where did I go wrong?

VS screen

These are the versions I use:

Microsoft Visual Studio Ultimate 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Version 4.5.50938

like image 829
Dmitry Avatar asked Nov 27 '25 07:11

Dmitry


1 Answers

I'm not sure how it happened but this is how I fix it:

  • right-click on the project and choose 'unload'
  • right-click on the project and choose 'Edit'
  • find in the file 'TimeoutWebClient'

I expect you to find something like this:

 <ItemGroup>
    <Compile Include="TimeoutWebClient.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TimeoutWebClient.Designer.cs">
      <DependentUpon>TimeoutWebClient.cs</DependentUpon>
    </Compile>
    <!-- other files go here -->

Remove the SubType tag. If you also want to undo any dependencies remove the <DependentUpon> tag as well.

Save your project file, right-click it and choose 'Reload'.
Verify if you achieved what you need.

like image 139
rene Avatar answered Nov 28 '25 22:11

rene



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!