<Subtype>Designer</Subtype> Added then removed by Visual Studio on load/unload

别说谁变了你拦得住时间么 提交于 2019-11-27 10:45:48

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.

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.

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.

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

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

I saw a question like yours in the follow link, and he solved his problem with this.

http://community.sharpdevelop.net/forums/t/9977.aspx

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.

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 came.

Hope this will help some one. Hence posting this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!