<子类型>设计师Visual Studio 在加载/卸载时添加然后删除

发布于 2024-08-07 09:18:33 字数 632 浏览 10 评论 0原文

有人以前见过这个吗?我有一个大型 Visual Studio 项目,它不断将 [Subtype]Designer[/Subtype] 添加到我的 .vcproj 中,然后在下一次打开和关闭项目时将其删除。 StoredImageControl.cs 中只定义了一个类。任何人都知道如何关闭它,因为它真的搞乱了我的版本控制。

这是之前:

<EmbeddedResource Include="StoredImageControl.resx">
  <DependentUpon>StoredImageControl.cs</DependentUpon>
</EmbeddedResource>

这是之后

<EmbeddedResource Include="StoredImageControl.resx">
  <DependentUpon>StoredImageControl.cs</DependentUpon>
  <SubType>Designer</SubType>
</EmbeddedResource>

Anyone see this before? I have a large Visual Studio project that keeps adding [Subtype]Designer[/Subtype] to my .vcproj then removing it on the next open and close of the project. There is only one class defined in StoredImageControl.cs. Anyone know how to shut this off as it is really messing up my revision control.

This is before:

<EmbeddedResource Include="StoredImageControl.resx">
  <DependentUpon>StoredImageControl.cs</DependentUpon>
</EmbeddedResource>

This is after

<EmbeddedResource Include="StoredImageControl.resx">
  <DependentUpon>StoredImageControl.cs</DependentUpon>
  <SubType>Designer</SubType>
</EmbeddedResource>

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

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

发布评论

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

评论(6

暖伴 2024-08-14 09:18:33

这可能与您在保存的解决方案状态下打开的文件有关。我在 VS2010 中遇到了这个问题,发现如果我在编辑器中打开 .xml 文件时关闭解决方案,那么在随后重新打开解决方案时,包含该 .xml 文件的项目将得到此 添加了Designer 行。但是,如果我在没有打开该文件的情况下关闭解决方案,它不会尝试在以下重新打开时添加该行。

This might be related to what files you have open in the saved solution state. I ran into this problem in VS2010 and found that if I close the solution while an .xml file was open in the editor, then on the subsequent re-open of the solution, the project containing that .xml file would get this <SubType>Designer</SubType> line added. If I close the solution without that file open, though, it does not try to add that line on the following re-open.

陪我终i 2024-08-14 09:18:33

这在至少 3 个版本的 Visual Studio(2008 年、2010 年和现在的 2012 年)中都是一个问题。它被记录为 Microsoft Connect 中的错误,但 MS 的回答是“我们已记录您的请求,但目前不打算修复此问题。”建议您对错误报告进行投票,因为它仍然处于活动状态,并且如果有足够的投票,可能会得到 MS 更好的响应。

This has been an issue in at least 3 editions of Visual Studio, 2008, 2010 and now 2012. It is logged as a bug in Microsoft Connect but the MS answer is "We have recorded your request but are not planning on fixing this at this time." Suggest you up vote the bug report as it is still active and might get a better response from MS with enough up votes.

倚栏听风 2024-08-14 09:18:33

我在 ASP.NET Web 应用程序的 .csproj 文件中遇到了同样的问题:

<ItemGroup>
  <Content Include="site.master" />
  <Content Include="Web.config">
    <SubType>Designer</SubType>
  </Content>
</ItemGroup>

对比:

<ItemGroup>
  <Content Include="site.master" />
  <Content Include="Web.config" />
</ItemGroup>

我对此问题的烦恼也是由于修订控制更改所致。该问题似乎存在于 VS 2005/2008/2010 中。在微软论坛上发现了以下问题,但答案不明确。

我希望 VS 设置会导致它,在这种情况下,当我找到该设置是什么时,我会希望您知道。

I am encountering the same problem in my ASP.NET web application's .csproj file:

<ItemGroup>
  <Content Include="site.master" />
  <Content Include="Web.config">
    <SubType>Designer</SubType>
  </Content>
</ItemGroup>

Versus:

<ItemGroup>
  <Content Include="site.master" />
  <Content Include="Web.config" />
</ItemGroup>

My annoyance with this issue is due to revision control changes as well. The issue seems to be present in VS 2005/2008/2010. Have found the following question on Microsoft forums, but the answer is not clear.

I hope that a VS setting causes it, in which case, I will like you know when I find out what that setting is.

北城挽邺 2024-08-14 09:18:33

您是否尝试将 SubType 作为 EmbeddedResource 对象的属性?

<EmbeddedResource Include="StoredImageControl.resx" SubType="Designer"> 
  <DependentUpon>StoredImageControl.cs</DependentUpon> 
</EmbeddedResource> 

我在以下链接中看到了像您这样的问题,他用这个解决了他的问题:

https://web.archive.org/web/20180209234638/http://community.sharpdevelop.net/forums/t/9977.aspx

Do you try to put the SubType as an attribute of the EmbeddedResource object?

<EmbeddedResource Include="StoredImageControl.resx" SubType="Designer"> 
  <DependentUpon>StoredImageControl.cs</DependentUpon> 
</EmbeddedResource> 

I saw a question like yours in the following link and he solved his problem with this:

https://web.archive.org/web/20180209234638/http://community.sharpdevelop.net/forums/t/9977.aspx

一页 2024-08-14 09:18:33

我发现 Designer 更改了 Web.config 的行为。

我们使用WebDeploy来发布Web服务文件。

如果为 Web.config 设置了子类型 - 它会在所有内容文件和 .svc 所在的主目录下正确发布此文件。

如果 SubType 未设置 - 它会执行上述操作,但还会将 Web.config 复制到 bin\ 子目录下 - 这非常奇怪!在 MsBuild 日志中,这种情况发生在 CollectFilesFrom_SourceItemsToCopyToOutputDirectory 目标期间。

I found that <SubType>Designer</SubType> changes the behaviour for Web.config.

We use WebDeploy to publish web service files.

If SubType is set for Web.config - it publishes this file correctly under the main directory where all content files go and .svc.

If SubType is not set - it does above but also copies Web.config under bin\ subdirectory - which is very strange! In MsBuild log this happens during CollectFilesFrom_SourceItemsToCopyToOutputDirectory target.

挽袖吟 2024-08-14 09:18:33

对我来说,当向项目添加新文件时,这也会导致版本控制问题。

作为解决方法,我做了:撤消对项目文件的挂起更改,然后通过右键单击 -> 手动添加新文件。将现有文件添加到项目中。

执行此操作时,标签 <子类型>设计师< /SubType > 没有出现。

希望这会对某人有所帮助。因此发布此内容。

For me also this causes issues with version control when added new files to the project.

As a work around I did: undo pending changes to the project file and then manually added new files by right click -> add existing files to the project.

While doing this the tag < SubType >Designer< /SubType > doesn't come.

Hope this will help someone. Hence posting this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文