locked
What is <SubType>Designer</SubType> for in .csproj? RRS feed

  • Question

  • When I open a solution which consists of bunch of projects, sometimes I just edited one project and rebuild, the IDE asks me to save a bunch of file I didn't edit...

     

    With some investigation,  I found out that somehow those csproj got "<SubType>Designer</SubType>" added...

     

    What is this tab for in the csproj? What is the reason this was added and why this was not there at the beginning?

     

    Is there a documentation about all tabs in csproj?

     

    Thanks.

    Friday, December 14, 2007 7:54 AM

Answers

All replies

  • Thanks for the links. However, after scanning thru them, I still think these answer my queries below,

     

    What is this tag for in the csproj?

    What is the reason this was added (i.e. What triggers <SubType>Designer</SubType> added to the csproj? )

    and why this was not there at the beginning?

     

    Can you help to elobarate more? Thanks.
    Friday, December 14, 2007 9:27 AM
  • Hi,

     

    As I understand, the SDK document for the project SubType is very clear. Could you please clarify which part in this document you can't understand it? If you installed VS.NET 2005 in your PC, you can find project SubType sample codes in the default folder - "C:\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Archive\CS_Samples\ProjectSubtype\ProjectSubtype" provided in the SDK as your guide for much of the features you needed to implement. Besides, try to check out this blog about "VS 2005 Project Subtypes" for reference - http://weblogs.asp.net/rgillen/archive/2006/06/15/VS-2005-Project-Subtypes.aspx

     

    Hope this helps,

    Regards,

     

    Monday, December 17, 2007 8:01 AM
  • I am in exactly the same situation and don't think this thred answers the original question.

     

    I use SVN for source control, when I get the solution from the repository and open it, VS tells me to reload some of the projects and on reload, the project file has changed. it has an extra line <Subtype>Designer</Subtype> and I do not want this line to automatically appear in my csproj file, what do I need to do?

    Friday, January 4, 2008 4:35 PM
  • I agree with Wood and sparkhi. 

     

    The question isn't "What are SubTypes and how do you use them". 

     

    The question is, "Why, when opening up a given .csproj, does this SubType block get inserted automatically by the IDE when it wasn't needed originally?"   What does this block do?  And why was it inserted by the IDE requiring a modification commit into source control?

     

    FYI, this same problem exists in VS2008.
    Wednesday, April 2, 2008 11:47 PM
  • Has anyone resolved this?

    We are experiencing the same thing in our development group now.  Sometimes it changes because the IDE ADDs these tags, other times it changes because the IDE REMOVES them.

    Could it be related to a particular developer's IDE settings?  We have a team in Germany and a team in the US working on the same code base.  Some quick research shows that whenever a member of the German team commits a change to a csproj, the <SubType> flag is added.  When we get these files and build the projects in the US, the IDE removes these tags from the cproj file. 

    It's rather annoying to see changes to files that are not legitimate and it adds complexity to our revision tree in source control.  So I would ask the same question as the OP: 

    What triggers the insertion of this <SubType> block, why do some IDEs add it and others remove it, and is there a setting we can all set to make sure our environments are the same?

    Thanks,

    Josh

    • Edited by Josh Starner Friday, August 8, 2008 1:29 PM corrected incorret use of IDE
    Friday, August 8, 2008 1:28 PM
  • Surprise to see even after 2 years no one has explained a reason for it.

     

    I got the same same "<SubType>Designer</SubType>" added in my code project automatically. and I am surprise too see that.. 

     

    Has anyone get any answer yet..?

     

    Thnx n Rgds

    Nishant 

    Friday, December 10, 2010 7:15 AM
  • Surprise to see even after 2 years no one has explained a reason for it.

     

    I got the same same "<SubType>Designer</SubType>" added in my code project automatically. and I am surprise too see that.. 

     

    Has anyone get any answer yet..?

     

    Thnx n Rgds

    Nishant 

    you can remove them, and the project is still working.(that's what I usually do)

    It means "<SubType>Designer</SubType>" is not necessary or required, so you can treat it as one bug in MS's bugs. :)

     

    hope this helps

    Oscar

    Thursday, March 3, 2011 2:58 AM
  • Hummm... Yeah thats what I did.. it worked fine.

     

    But I was really intrigued by the fact that even after 2 years non of the MS guys fix this ;) :P though it sounds pretty simply but who knows the devils of the code :P

     

     

    Cheers !

    Nishant

    Thursday, March 3, 2011 3:03 AM
  • Subscribing to this question, since I'd also like to know the answer as to why these lines in the .csproj seem to be added & removed at random.  The "answers" in this thread don't answer the question at all, unfortunately, and should really be un-marked.
    Wednesday, June 8, 2011 8:28 PM
  • I am looking at the same problem. but with <SubType>Form</SubType> and <SubType>Object</SubType>.  Very annoying that there has not been an answer or aknowlegment from MS about this.
    Friday, June 24, 2011 4:33 PM
  • @reginaldStjohn: Yeah may be because someone has already marked it as answer..  Though very annoying indeed MS should give acknowledgment.. neways.

    hopefully some day we get an explanation for that.

    Monday, June 27, 2011 1:45 AM
  • I am also having this same issue. In Visual Studio 2008 and 2010, 

    <Compile Include="myForm.vb" />
    

    gets changed into 

    <Compile Include="frmRPChangeOwner.vb">
      <SubType>Designer</SubType>
    </Compile>

    on a seemingly random basis. Sometimes VS removes it, sometimes it adds it, and I can't make it happy.

    Tuesday, August 9, 2011 9:19 PM
  • This does not answer the question as to why Visual Studio adds and removes this tag when projects are loaded.
    Tuesday, August 9, 2011 9:20 PM
  • This also does not answer the question as to why Visual Studio adds and removes this tag when projects are loaded.
    Tuesday, August 9, 2011 9:21 PM
  • Have the same problem. Found something interesting.

    My cs file was showing as a component and double click resulted in error. The message is: " CookieAwareWebClient can be seigned but it's not the first class in your file. (And that's a true)

    I have several classes in this file, two are the descendants of WebClient class which is the child of... Component class. That's it!

    I moved these classes to separate files, and Studio treats them as designable components. And my initial file became a usual C# file.

    So, I think it's a mere bug, when VS does some job it was not asked to.




    Thursday, December 8, 2011 7:06 PM
  • I recently had this pop up on a .config file when I only  made text edits to it.  The only difference it made was when right clicking the file it then had the context menu options added: "View Designer", "View Code".   They are totally non-applicable to a .config file and clicking either of them accomplished nothing.  I reverted the change to the .csproj file and everything was dandy.  I think that subtype makes good sense for certain kinds of files.  But it appears there is a little bug in visual studio that sometimes causes it to apply incorrectly.
    Monday, February 6, 2012 2:04 PM
  • An upgrade of a vs2008 solution to vs2010 solution gave a new twist to this :
      <Page Include="View\RulesEditor.xaml">
          <Generator>MSBuild:Compile</Generator>
          <SubType>Designer</SubType>
          <Generator>MSBuild:Compile</Generator>
          <SubType>Designer</SubType>
        </Page>
    The upgrade consistently added the duplicates.
    Though this doesn’t cause any problem, if I have two or single tag.

    Thursday, March 1, 2012 8:37 AM