{"id":4003,"date":"2010-03-16T12:43:00","date_gmt":"2010-03-16T12:43:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2010\/03\/16\/vs-2010-and-source-control-providers\/"},"modified":"2019-02-18T18:45:37","modified_gmt":"2019-02-18T18:45:37","slug":"vs-2010-and-source-control-providers","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/vs-2010-and-source-control-providers\/","title":{"rendered":"VS 2010 and Source Control Providers"},"content":{"rendered":"<p class=\"MsoNormal\"><font size=\"3\"><font face=\"Calibri\"><span>Hi, I recently explained <\/span><span><font color=\"#0000ff\"><a class=\"\" href=\"http:\/\/blogs.msdn.com\/vcblog\/archive\/2010\/02\/16\/project-settings-changes-with-vs2010.aspx\">the reasons behind the project settings changes we made for VS 2010<\/a><\/font>.<\/span><span> Let me describe to you toda<\/span>y,<span> how some of these changes may impact source control providers.<\/span><\/font><\/font><\/p>\n<p><b><span><font face=\"Calibri\"><\/p>\n<p class=\"MsoNormal\"><b><span>The new .vcxproj extension and SCC<\/span><\/b><\/p>\n<p><\/font><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span><font face=\"Calibri\">We changed the C++ project file format in VS2010, migrating to the new MSBuild syntax, and we changed the project file extension from <\/font><\/span><span>vcproj<\/span><span><font face=\"Calibri\"> to <\/font><\/span><span>vcxproj<\/span><font face=\"Calibri\"> to reflect this change<span>. This change may impact SCC providers, depending on their design and implementation. <\/span><\/font><\/font><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\" size=\"3\">For example, most SCC providers based on an <\/font><\/span><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb165760(VS.100).aspx\"><font color=\"#0000ff\"><font size=\"3\"><span>mssccprj.scc<\/span><font face=\"Calibri\"> bindings hint file<\/font><\/font><\/font><\/a><font size=\"3\"><span><font face=\"Calibri\"> would not be able to create this file anymore because the provider only creates it for registered project extensions. Existing SCC providers will not track the new <\/font><\/span><span>vcxproj<\/span><span><font face=\"Calibri\"> extension without user or vendor intervention. <\/font><\/span><\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span><font face=\"Calibri\">As a result of not being able to leverage the <\/font><\/span><span>mssccprj.scc<\/span><span><font face=\"Calibri\"> file for a <\/font><\/span><span>vcxproj<\/span><span><font face=\"Calibri\"> file, VS will instead embed the binding information into the project in two places<\/font><\/span><\/font><\/p>\n<p class=\"MsoListParagraph\"><span><span><font size=\"3\">\u00b7<\/font><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font size=\"3\"><b><span>vcxproj<\/span><span><font face=\"Calibri\"> <\/font><\/span><\/b><span><font face=\"Calibri\">file. This file stores <\/font><\/span><span>SccProjectName<\/span><span><font face=\"Calibri\">, <\/font><\/span><span>SccLocalPath<\/span><span><font face=\"Calibri\"> and <\/font><\/span><span>SccProvider<\/span><span><font face=\"Calibri\"> as global property elements.<\/font><\/span><\/font><\/p>\n<p class=\"MsoListParagraph\"><span><span><font size=\"3\">\u00b7<\/font><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font size=\"3\"><b><span>suo<\/span><\/b><span><font face=\"Calibri\"> file. This is the per solution user setting file and it is used to store the <\/font><\/span><span>SccAuxPath<\/span><font face=\"Calibri\"> property<span>.<\/span><\/font><\/font><\/p>\n<p><font size=\"+0\"><font face=\"Calibri\"><span><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span>While this is not necessarily a bad thing, the source code control experience in VS is simpler if the SCC provider is tracking this kind of information. Let\u2019s<\/span><span>,<\/span><span> examine opening from source <\/span>control, and<span> from branched locations. <\/span><\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span>Add a new project to source control, under $\/Project location. Because the source control provider can\u2019t track the new project extension (.vcxproj)<\/span>,<span> it will persist the source control information in the project file. Later<\/span>,<span> create a new branch from $\/Project, $\/BranchedProject. Open $\/BranchedProject from source control into a different location on disk. The project file will still keep embedded source control information pointing to $\/Project and not $\/BranchedProject. To start working against the new branch instead of the original branch<\/span>,<span> you should change source control information via File<\/span><span>\u00e0<\/span><span>Source Control<\/span><span>\u00e0<\/span><span>Change Source Control. <\/span><\/font><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\">This extra step can be avoided if the source control provider is able to track the new project extension, because the mssccprj.scc hint file will contain the correct branch information from the start.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><b><span><font size=\"3\">Vendor Fix<\/font><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><font size=\"3\">To make integration simpler for the user, when SCC providers detect integration with VS 2010, it should add the new <span>vcxproj<\/span> extension to the list of recognized VS project extensions or at least provide a way for the user to add it in the UI. <\/font><\/p>\n<p class=\"MsoNormal\"><b><span><font size=\"3\">User Fix<\/font><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span>Some SCC providers such as Microsoft Visual Source Safe already allow the tracked extensions list to be edited by a user. In VSS client this can be done via Tools <\/span><span>\u00e0<\/span><span> Options <\/span><span>\u00e0<\/span><span> File Types in Source. If you are using Source Safe, add the new project extension to the list before adding new projects to source code control or converting old controlled projects to VS2010.<\/span><\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/Source%20Control%20Providers1.png\"><\/span><\/font><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<b><span>The new .vcxproj.filters file and SCC <\/span><\/b><\/span><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span>Another change made for VS2010<\/span>, <span>moved the Solution Explorer <\/span>filter\u2019s information<span> from the project file into a separate file. This file is located on disk adjacent to the <\/span><span>vcxproj<\/span><span> project file, with the same name but a <\/span><span>.vcxproj.filters<\/span><span> extension. This change requires vendor intervention to ensure compatibility. <\/span><\/font><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\">From the SCC perspective, this adds a new \u201cmaster \u2013 special\u201d relationship between the project and the filters file. This SCC concept is not new and refers to the behavior of special files where they remain transparent to the user, hidden in the UI but moving from workspace to depot in lockstep with their master file. The hiding behavior may vary from one SCC provider to another, but let me exemplify how Source Safe handles the \u201cmaster \u2013 special\u201d relationship. <\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\">In VSS, special files never show up in solution explorer or in the pending check-ins\/checkout windows, they are listed only when they have a different source code control operation status to their master file.<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span>For example, if you add a new header file to your source code controlled C++ project, this will generate a project change and also a filters change. Both the project and filters files will be checked out, but in the SCC pending check-in tool window only the project file will show up as changed. Howeve<\/span>r,<span> if you rename a Solution Explorer filter or move a file between filters, this change does not affect the project file and in this situation only the filters file will show up in the SCC pending check-in window.<\/span><\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><span>This new relationship might impact third party SCC providers that previously didn\u2019t have code that consid<\/span>ered <span>special files. A symptom of missing support is that when opening a vcxproj from source code control the project is displayed in Solution Explorer without the filter hierarchy and the <\/span><span>.vcxproj.filters <\/span>file is missing from its expected location on disk.<\/font><\/p>\n<p><font size=\"3\"><b><span><\/p>\n<p class=\"MsoNormal\"><b><span>Project&nbsp;Conversion and SCC<\/span><\/b><\/p>\n<p><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><b><span>Command Line upgrade.<\/span><\/b><\/p>\n<p class=\"MsoNormal\"><span>If<\/span><span> <\/span>a <span>VS2010 solution and project conversion <\/span>are<span> performed at the command line, conversion has no access to any SCC providers. SCC integration is typically only available from within the VS IDE. If projects are converted with commands like \u201c<\/span><span>devenv \/upgrade<\/span><span>\u201d or \u201c<\/span><span>vcupgrade<\/span><span>\u201d and SCC settings are not stored inside the project, the solution will not be bound to the source code control depot when the converted solution is loaded. <\/span><\/p>\n<p class=\"MsoNormal\"><span><img decoding=\"async\" height=\"127\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/Source%20Control%20Providers2.png\" width=\"624\"><\/span><\/p>\n<p class=\"MsoNormal\"><span><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/Source%20Control%20Providers3.png\">&nbsp;<\/span><\/p>\n<p><span><\/p>\n<p class=\"MsoNormal\"><span>This can be fixed by manually rebinding the local workspace to the SCC depot (File <\/span><span>\u00e0<\/span><span> Source Control <\/span><span>\u00e0<\/span><span> Change Source Control). <\/span><\/p>\n<p class=\"MsoNormal\"><span>It might also be necessary to check out the solution before running the command line tools because<\/span>,<span> the command line conversion cannot request a checkout but will have modified at least the solution file locally. This can also be remedied from inside the IDE when you first load the converted solution. <\/span><\/p>\n<p class=\"MsoNormal\"><span>If you are not using Visual Studio, but just MS command line tools and support such as the Windows SDK, this problem must be fixed up using the 3rd party SCC client software.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><b><span>Visual Studio IDE upgrade<\/span><\/b><b><span><\/span><\/b><\/p>\n<p class=\"MsoNormal\"><span>If you convert from within the VS IDE and your source control provider is either TFS or VSS, the new <\/span><span>vcxproj<\/span><span> projects and their filters files should be controlled automatically. VSS provides also the option of checking in the new projects and filters files, between the conversion finish and the first solution load, as you can see in the below screenshot.<\/span><\/p>\n<p class=\"MsoNormal\"><span><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/Source%20Control%20Providers4.png\"><\/span><\/p>\n<p><span><\/p>\n<p class=\"MsoNormal\"><span>Note<\/span>,<span> that in the above screenshot the filters file is not included because it has the same source control status (pending add) as its master file. <\/span><\/p>\n<p class=\"MsoNormal\"><span>For some third party source control providers, the new project and filters files might not be automatically controlled after conversion from Orcas<\/span>.<span> <\/span>Unless,<span> the providers have implemented support for the new <\/span><span>.vcxproj<\/span><span> project extension and for the special-master relationship between the filters file and the project.<\/span><\/p>\n<p class=\"MsoNormal\"><span>For those SCC providers that respond with a pending add operation to any new file dropped on disk under the enlistment root, the new project and filters files will be coincidentally controlled. <\/span><\/p>\n<p class=\"MsoNormal\"><span>The new VS2010 project files should also be automatically controlled if the source control information was stored originally in the Orcas project files, because the conversion process would migrate those settings from .vcproj to .vcxproj, causing the new VS2010 projects to be detected as belonging to the same source control database.<\/span><\/p>\n<p class=\"MsoNormal\"><span>Some of the source control providers that are using a <\/span><span>mssccprj.scc<\/span><span> hint file might still detect the new VS2010 project files before implementing support for the new extension, if their implementation takes into account the source control information of the solution. This is possible because the solution is pointing after conversion to the new .vcxproj files (instead of the old .vcproj files) and since the solution extension remained the same (.sln) the mssccprj.scc hint file works as before. Th<\/span>us,<span> all new projects belonging to the controlled solution will be automatically controlled, if the source control provider implementation is considering this scenario.<a class=\"\" title=\"_GoBack\" name=\"_GoBack\"><\/a><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><b><span>Project extension change impact on third party source control providers<\/span><\/b><\/p>\n<p class=\"MsoNormal\"><span>The project extension change impacts third party SCC providers at conversion time in a few ways that might require Vendor intervention. <\/span><\/p>\n<p class=\"MsoListParagraph\"><span><span>\u00b7<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>As discussed previously, if the SCC provider uses the <\/span><span>mssccprj.scc<\/span><span> file <b>and<\/b> your source control provider does not know about the <\/span><span>vcxproj<\/span><span> extension, the source control information will now be stored in the project and .<\/span><span>suo<\/span><span> files.<\/span><\/p>\n<p class=\"MsoListParagraph\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoListParagraph\"><span><span>\u00b7<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>If the source control provider is using any special hint files based on composite of project file name (like <\/span><span>vspscc<\/span><span> files) those need to be renamed to take into account the new project extension. <\/span><\/p>\n<p class=\"MsoListParagraph\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoListParagraph\"><span><span>\u00b7<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>If the project extension is stored explicitly in any special file (like in <\/span><span>mssccprj.scc<\/span><span>) that needs to be replaced with the new extension. <\/span><\/p>\n<p class=\"MsoListParagraph\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>For these scenarios the SCC provider needs to know the name of the old project. <\/span>More specifically, the <span>IVsSccManager2.RegisterSccProject<\/span> method as implemented by the third party SCC provider needs to know whether the current opening project just finished a conversion operation and if so it then needs to know the name of the pre-conversion project. This can be answered by calling a new interface for VS 2010. <span>IVsProjectUpgradeViaFactory3<\/span> in the <span>Microsoft.VisualStudio.Shell.Interop <\/span>namespace. This new interface exposes the <span>CheckProjectUpgraded<\/span> method.<\/p>\n<p class=\"MsoNormal\"><span>[<\/span><span>GuidAttribute<\/span><span>(L<\/span><span>&#8220;943CE488-176F-457B-8C88-3502C775501C&#8221;<\/span><span>)]<br \/>[<\/span><span>InterfaceTypeAttribute<\/span><span>()]<br \/><\/span><span>public<\/span><span> interface <\/span><span>class<\/span><span> IVsProjectUpgradeViaFactory3<br \/>{<br \/>&#8230;<br \/><\/span><span>&nbsp;&nbsp;&nbsp; int<\/span><span> CheckProjectUpgraded<br \/>&nbsp;&nbsp;&nbsp; (<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [InAttribute] String^ pszFileName, <br \/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [OutAttribute] bool% pbUpgradeComplete,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [OutAttribute] String^% pbstrUpgradedProjectFileName<br \/>&nbsp;&nbsp;&nbsp; )<br \/>&#8230;<br \/>}<\/span><\/p>\n<p class=\"MsoNormal\"><span>Where:<\/span><\/p>\n<p class=\"MsoNormal\">\n<table class=\"MsoNormalTable\" cellSpacing=\"0\" cellPadding=\"0\" border=\"0\">\n<tbody>\n<tr>\n<td class=\"\" vAlign=\"top\" width=\"241\">\n<p class=\"MsoNormal\"><font size=\"3\"><span>pszFileName<\/span><span><\/span><\/font><\/p>\n<\/td>\n<td class=\"\" vAlign=\"top\" width=\"397\">\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">The current (after upgrade) name of the project about to be opened.<\/font><\/font><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" vAlign=\"top\" width=\"241\">\n<p class=\"MsoNormal\"><font size=\"3\"><span>pbUpgradeComplete<\/span><span><font face=\"Calibri\"> <\/font><\/span><\/font><\/p>\n<\/td>\n<td class=\"\" vAlign=\"top\" width=\"397\">\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">Returns whether the project was just successfully upgraded.<\/font><\/font><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" vAlign=\"top\" width=\"241\">\n<p class=\"MsoNormal\"><font size=\"3\"><span>pbstrUpgradedProjectFileName<\/span><span><\/span><\/font><\/p>\n<\/td>\n<td class=\"\" vAlign=\"top\" width=\"397\">\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">Returns the before upgrade name of the project about to be opened, if it just successfully completed a conversion, or empty string otherwise.<\/font><\/font><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Thank you and let us know if you have any questions or concerns about this subject.<\/span><\/p>\n<p class=\"MsoNormal\"><span>Andreea Isac<br \/>Software Development Engineer<br \/>VC Project and Build Team<\/span><\/p>\n<p><\/span><\/span><\/font><\/span><\/font><\/span><\/font><\/font><\/p>\n<p class=\"MsoListParagraph\"><font size=\"3\"><font face=\"Calibri\"><span><\/span><\/font><\/font>&nbsp;<\/p>\n<p class=\"MsoListParagraph\"><font size=\"3\"><font face=\"Calibri\"><span><\/span><\/font><\/font>&nbsp;<\/p>\n<p class=\"MsoListParagraph\"><font size=\"3\"><font face=\"Calibri\"><span><\/span><\/font><\/font>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, I recently explained the reasons behind the project settings changes we made for VS 2010. Let me describe to you today, how some of these changes may impact source control providers. The new .vcxproj extension and SCC We changed the C++ project file format in VS2010, migrating to the new MSBuild syntax, and we [&hellip;]<\/p>\n","protected":false},"author":289,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[40,41],"class_list":["post-4003","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","tag-source-control","tag-vs2010"],"acf":[],"blog_post_summary":"<p>Hi, I recently explained the reasons behind the project settings changes we made for VS 2010. Let me describe to you today, how some of these changes may impact source control providers. The new .vcxproj extension and SCC We changed the C++ project file format in VS2010, migrating to the new MSBuild syntax, and we [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/4003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/289"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=4003"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/4003\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=4003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=4003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=4003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}