Upgrading exporters from VS2017 to VS2019

It’s pain to create a new VS2019 exporter, copy all the settings from VS2017, and then deleted VS2017. Is it safe to just open the XML and change all 2017 to 2019? Or will this silently break things?

Based on the diff between MSVCProjectExporterVC2017 and MSVCProjectExporterVC2019, it seems safe.

@@ -1,7 +1,7 @@
-class MSVCProjectExporterVC2017  : public MSVCProjectExporterBase
+class MSVCProjectExporterVC2019  : public MSVCProjectExporterBase
 {
 public:
-    MSVCProjectExporterVC2017 (Project& p, const ValueTree& t)
+    MSVCProjectExporterVC2019 (Project& p, const ValueTree& t)
         : MSVCProjectExporterBase (p, t, getTargetFolderForExporter (getValueTreeTypeName()))
     {
         name = getName();
@@ -10,18 +10,18 @@
         platformToolsetValue.setDefault (getDefaultToolset());
     }
 
-    static const char* getName()                                     { return "Visual Studio 2017"; }
-    static const char* getValueTreeTypeName()                        { return "VS2017"; }
-    int getVisualStudioVersion() const override                      { return 15; }
-    String getSolutionComment() const override                       { return "# Visual Studio 2017"; }
-    String getToolsVersion() const override                          { return "15.0"; }
-    String getDefaultToolset() const override                        { return "v141"; }
-    String getDefaultWindowsTargetPlatformVersion() const override   { return "Latest"; }
+    static const char* getName()                                     { return "Visual Studio 2019"; }
+    static const char* getValueTreeTypeName()                        { return "VS2019"; }
+    int getVisualStudioVersion() const override                      { return 16; }
+    String getSolutionComment() const override                       { return "# Visual Studio 2019"; }
+    String getToolsVersion() const override                          { return "16.0"; }
+    String getDefaultToolset() const override                        { return "v142"; }
+    String getDefaultWindowsTargetPlatformVersion() const override   { return "10.0"; }
 
-    static MSVCProjectExporterVC2017* createForSettings (Project& projectToUse, const ValueTree& settingsToUse)
+    static MSVCProjectExporterVC2019* createForSettings (Project& projectToUse, const ValueTree& settingsToUse)
     {
         if (settingsToUse.hasType (getValueTreeTypeName()))
-            return new MSVCProjectExporterVC2017 (projectToUse, settingsToUse);
+            return new MSVCProjectExporterVC2019 (projectToUse, settingsToUse);
 
         return nullptr;
     }
@@ -30,8 +30,8 @@
     {
         MSVCProjectExporterBase::createExporterProperties (props);
 
-        static const char* toolsetNames[] = { "v140", "v140_xp", "v141", "v141_xp" };
-        const var toolsets[]              = { "v140", "v140_xp", "v141", "v141_xp" };
+        static const char* toolsetNames[] = { "v140", "v140_xp", "v141", "v141_xp", "v142" };
+        const var toolsets[]              = { "v140", "v140_xp", "v141", "v141_xp", "v142" };
         addToolsetProperty (props, toolsetNames, toolsets, numElementsInArray (toolsets));
 
         addIPPLibraryProperty (props);
@@ -39,5 +39,5 @@
         addWindowsTargetPlatformProperties (props);
     }
 
-    JUCE_DECLARE_NON_COPYABLE (MSVCProjectExporterVC2017)
+    JUCE_DECLARE_NON_COPYABLE (MSVCProjectExporterVC2019)
 };
1 Like

We’ve recently created VS2019 exporters from our VS2015 exporters in the way you’ve suggested and have not encountered any issues so far. So from our experience, I would say it seems safe.

1 Like