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,
-
Check for the file name for which the error is given.
-
Find out in which project the file is included.
-
Open the .csproj file for that particular project (This file can be found in the directory where solution is placed).
-
Search for the file name for which the error is thrown in the .csproj file.
-
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>
-
Delete any one line from one of them.
-
Save the changes.
-
Reload the project your error must have gone.