VS 2008 keeps removing and re-adding <SubType>ASPXCodeBehind</SubType>
asp.netVisual StudioVisual Studio-2010Visual Studio-2008Visual Studio-2015asp.net Problem Overview
I've got a VS 2008 C# Web project and whenever I make some changes to the files in it (not even to the project file itself) VS will remove some lines like this from the csproj file:
<SubType>ASPXCodeBehind</SubType>
So something like this:
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
will become
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
BUT the next time I work on this project it will add those lines back! It keeps going back and forth like this, resulting in a lot of meaningless "changes" in our source control system. This never used to happen with VS 2005 and it doesn't seem to be happening for other developers who work on the same project file, only for me.
Does anyone know why this is happening and how I can stop it from doing this?
asp.net Solutions
Solution 1 - asp.net
For me, the difference depends on whether or not the web project is open in Visual Studio.
I find if I commit the project file to version control with the project open in Visual Studio the SubType elements are present. Closing the solution/project then removes the SubType elements from the project file. Now I always ensure my commits are performed with the project closed in VS to avoid unnecessary changes to the project file.
Solution 2 - asp.net
Working on VS2010 and solved this issue by deleting solutionFileName.sln.DotSettings.user file and solutionFileName.suo. That helped me, give it a try.
Solution 3 - asp.net
Splitting the content of your file into multiple files - one file per class may help.
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=283434
Up-to-date link:
Solution 4 - asp.net
These lines are also appearing in the project file in VS2012 when committing project changes in Tortoise SVN. This project used to be a website that I converted into a web application.
I was able to bypass this issue using the following steps which do not require closing the project:
- Just prior to committing to SVN, clean the solution using "BUILD > Clean Solution".
- Click the "Save All" button to save the project file.
- Commit changes using Tortoise SVN.
- Continue working on project...