Solution 1:

I was facing the same problem in my solution with the same error for one of the source file,

I fixed it out as follows,

  1. Check for the file name for which the error is given.

  2. Find out in which project the file is included.

  3. Open the .csproj file for that particular project (This file can be found in the directory where solution is placed).

  4. Search for the file name for which the error is thrown in the .csproj file.

  5. You will find two entries of the line such as

 <Compile Include="duplicate.aspx.cs">
      <SubType>ASPXCodeBehind</SubType>
      <DependentUpon>Duplicate.aspx</DependentUpon>
    </Compile>


 <Compile Include="duplicate.aspx.cs">
      <SubType>ASPXCodeBehind</SubType>
      <DependentUpon>Duplicate.aspx</DependentUpon>
    </Compile>
  1. Delete any one line from one of them.

  2. Save the changes.

  3. Reload the project your error must have gone.

Solution 2:

For those who encountered the same problem, nothing helped them and they do not want to recreate the project: Try to delete YourPojectName.csproj.user file. It helped me. I modified the .csproj manually before and the modification introduced (somehow) probably some discrepancy to the two files.