问题
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>
回答1:
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.
回答2:
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.
回答3:
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.
- What is <SubType>Designer</SubType> for in .csproj?
I hope that a VS setting causes it, in which case, I will like you know when I find out what that setting is.
回答4:
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
回答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.
回答6:
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.
来源:https://stackoverflow.com/questions/1573241/subtypedesigner-subtype-added-then-removed-by-visual-studio-on-load-unload