VS 2008 不断删除并重新添加ASPXCodeBehind

发布于 2024-07-08 13:28:47 字数 706 浏览 8 评论 0原文

我有一个 VS 2008 C# Web 项目,每当我对其中的文件(甚至不是项目文件本身)进行一些更改时,VS 都会从 csproj 文件中删除这样的一些行:

<SubType>ASPXCodeBehind</SubType>

所以类似这样的内容:

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

将变为

<Compile Include="Default.aspx.cs">
  <DependentUpon>Default.aspx</DependentUpon>
</Compile>

<强>但是下次我处理这个项目时,它会将这些行添加回来! 就这样不断地来来回回,导致我们的源代码控制系统出现了很多无意义的“变化”。 这种情况在 VS 2005 中从来没有发生过,而且对于处理同一个项目文件的其他开发人员来说似乎也没有发生过,只有我才发生过。

有谁知道为什么会发生这种情况以及我如何阻止它这样做?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

旧伤慢歌 2024-07-15 13:28:47

对我来说,差异取决于 Web 项目是否在 Visual Studio 中打开。

我发现如果在 Visual Studio 中打开项目的情况下将项目文件提交到版本控制,则会出现 SubType 元素。 关闭解决方案/项目将从项目文件中删除 SubType 元素。 现在,我总是确保在 VS 中关闭项目的情况下执行提交,以避免对项目文件进行不必要的更改。

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.

内心激荡 2024-07-15 13:28:47

在VS2010上工作并通过删除solutionFileName.sln.DotSettings.user文件和solutionFileName.suo解决了这个问题。 这对我很有帮助,尝试一下。

Working on VS2010 and solved this issue by deleting solutionFileName.sln.DotSettings.user file and solutionFileName.suo. That helped me, give it a try.

浅沫记忆 2024-07-15 13:28:47

当在 Tortoise SVN 中提交项目更改时,这些行也会出现在 VS2012 的项目文件中。 这个项目曾经是一个网站,我将其转换为网络应用程序。

我能够使用以下步骤绕过这个问题,这些步骤不需要关闭项目:

  1. 在提交到 SVN 之前,使用“BUILD > Clean Solution”清理解决方案。
  2. 单击“全部保存”按钮保存项目文件。
  3. 使用 Tortoise SVN 提交更改。
  4. 继续开展项目...

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:

  1. Just prior to committing to SVN, clean the solution using "BUILD > Clean Solution".
  2. Click the "Save All" button to save the project file.
  3. Commit changes using Tortoise SVN.
  4. Continue working on project...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文