189

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>
Matthias
  • 4,481
  • 12
  • 45
  • 84
Jeff Lundstrom
  • 1,901
  • 2
  • 11
  • 5
  • Seeing the same thing with UserControl in VS 2005. Very strange. – David Gardiner Jun 25 '10 at 01:38
  • 1
    I also see this problem in VS 2008 – schoetbi Jul 07 '10 at 07:32
  • 1
    Ran into this in VS 2010. Also confused. – Jon Davis Sep 09 '10 at 01:26
  • Same thing happening to me in VS 2008 all the time. I try to diminish its source control impact by reverting soon after checkouts, right before starting to do any actual work... but it's a kludge and I often forget to do it. Have you tried to report it via connect.microsoft.com? – Alan Sep 25 '10 at 11:12
  • I'm experiencing the same in VS 2010. Pretty mysterious. – stacker Oct 06 '10 at 19:30
  • Also experiencing this in VS 2010. It wasn't a problem for several months, then started happening with no obvious explanation. – Michael Repucci Oct 25 '10 at 14:47
  • This is happening in VS2008 as well. Totally obnoxious. I don't have any fixes :( – jcollum Oct 27 '10 at 16:42
  • 2
    Why do you have a C# source code file in a C/C++ project? – Hans Passant Oct 31 '10 at 21:28
  • Seeing this with VS2008. It will add subtypes for Form and UserControl, then remove them later. And only on one project in my solution that I'm not even working with. – MrKWatkins Mar 02 '12 at 15:15
  • [System.ComponentModel.DesignerCategory("Code")]
    look at this http://www.interact-sw.co.uk/iangblog/2004/06/10/codeviewinvs
    – Artem Golovko Jun 03 '17 at 18:04
  • I opened an [issue](https://github.com/dotnet/project-system/issues/3186) for this problem. Anyone who encounters it, please reply to it with information about how and where it occurred, so MS can fix it. The issue is currently closed until steps to reproduce have been provided. – enzi Feb 27 '18 at 07:59
  • **Update:** I reported the problem [here](https://developercommunity.visualstudio.com/content/problem/204355/subtype-designer-is-added-unnecessarily-to-xml-bas.html) where you can vote for the issue. – enzi Feb 27 '18 at 12:37
  • Also https://github.com/dotnet/project-system/issues/182 – StayOnTarget Jan 12 '22 at 13:59

6 Answers6

98

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.

Nathan Reed
  • 3,583
  • 1
  • 26
  • 33
  • 8
    That seems to have been the issue for me (VS 2010 also). Annoying though that Visual Studio would make its own changes to your files just based on which ones are open, especially since they show up in your source control system. Gotta love Microsoft's "features"... – Ben Sutton Jan 11 '12 at 23:53
  • 10
    This is still an open issue with MS : http://connect.microsoft.com/VisualStudio/feedback/details/757970/subtype-aspxcodebehind-subtype-being-added-and-removed-in-csproj-file – Pat Dec 19 '13 at 05:40
  • 4
    It's VS2015, and yet this still occurs. – Johnny_D Jul 11 '17 at 23:35
  • 4
    VS2017, still an issue. Makes using source control impossible, because VS is constantly adding these stupid `Designer` tags sporadically. – Triynko Feb 21 '18 at 17:59
  • 1
    They killed connect but https://developercommunity.visualstudio.com/content/problem/204355/subtype-designer-is-added-unnecessarily-to-xml-bas.html says it's solved at least for VS2019 Preview 2 – Josh Sutterfield May 24 '19 at 01:28
  • 1
    Still happens in VS2019 (16.7.2)! The dev case listed as solved... perhaps that's just 'fixed' for .NET Core project csproj files? – CJBS Sep 02 '20 at 18:03
41

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.

JohnC
  • 1,797
  • 1
  • 18
  • 26
8

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:

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

Vladislav Povorozniuc
  • 2,149
  • 25
  • 26
Mauro Gagna
  • 173
  • 1
  • 9
  • 1
    Using the `SubType` attribute trick does not work on `` elements: VS2010 complains that the attribute is unrecognized. – Pierre Arnaud Feb 02 '12 at 05:11
8

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.

JohnB
  • 18,046
  • 16
  • 98
  • 110
  • 1
    Issue is pressent in vs 2013 as well. – Johan Oct 21 '14 at 14:32
  • Just another example of Visual Studio modifying files when it feels like. One day Microsoft will finally realize that the user should be in charge and randomly changing files without the users OK should NEVER happen – goneskiing Sep 14 '15 at 22:00
4

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.

Ivan
  • 9,089
  • 4
  • 61
  • 74
0

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.

Vladislav Povorozniuc
  • 2,149
  • 25
  • 26
NidhinSPradeep
  • 1,186
  • 2
  • 14
  • 15