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

6

191

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>
Muhammadan answered 15/10, 2009 at 15:47 Comment(13)
Seeing the same thing with <SubType>UserControl</SubType> in VS 2005. Very strange.Gemination
I also see this problem in VS 2008Lomond
Ran into this in VS 2010. Also confused.Grantee
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?Shields
I'm experiencing the same in VS 2010. Pretty mysterious.Cultivar
Also experiencing this in VS 2010. It wasn't a problem for several months, then started happening with no obvious explanation.Lupien
This is happening in VS2008 as well. Totally obnoxious. I don't have any fixes :(Tother
Why do you have a C# source code file in a C/C++ project?Quinte
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.Calumnious
[System.ComponentModel.DesignerCategory("Code")] <br> look at this interact-sw.co.uk/iangblog/2004/06/10/codeviewinvsTempest
I opened an issue 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.Parma
Update: I reported the problem here where you can vote for the issue.Parma
Also github.com/dotnet/project-system/issues/182Responsibility
I
99

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.

Infrequent answered 8/11, 2011 at 18:19 Comment(6)
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"...Luong
This is still an open issue with MS : connect.microsoft.com/VisualStudio/feedback/details/757970/…Eclipse
It's VS2015, and yet this still occurs.Chowder
VS2017, still an issue. Makes using source control impossible, because VS is constantly adding these stupid <Subtype>Designer</SubType> tags sporadically.Nauseate
They killed connect but developercommunity.visualstudio.com/content/problem/204355/… says it's solved at least for VS2019 Preview 2Indeterminacy
Still happens in VS2019 (16.7.2)! The dev case listed as solved... perhaps that's just 'fixed' for .NET Core project csproj files?Stinkhorn
W
42

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.

Wilfredowilfrid answered 16/4, 2013 at 13:59 Comment(6)
2013 and now 2015 have the same issue.Asphaltite
Yup, saw it for the first time in VS2015 just now.Wilfredowilfrid
No JohnC, it is not a bug, it is a criminal offense.Ensheathe
Microsoft Connect has been deprecated, I opened a new issue on developercommunity.visualstudio.com. It is "Under Consideration", so vote it up!Parma
"We have fixed this issue and it's available in Visual Studio 2019 Preview 2 Thank you for your feedback!" - according to a solution on the devcommunity issue.Indeterminacy
VS2019 16.11.5 still does this.Responsibility
C
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:

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

Chicalote answered 26/10, 2010 at 18:4 Comment(1)
Using the SubType attribute trick does not work on <Content> elements: VS2010 complains that the attribute is unrecognized.Diabolic
P
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.

Protuberancy answered 21/11, 2010 at 18:38 Comment(2)
Issue is pressent in vs 2013 as well.Rufina
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 happenExtranuclear
J
5

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.

Jujutsu answered 22/10, 2015 at 15:41 Comment(0)
S
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.

Sharpwitted answered 2/7, 2019 at 7:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.