aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2017-09-11 17:45:25 +0200
committerMiguel Costa <miguel.costa@qt.io>2017-09-13 15:15:57 +0000
commitb06e10e85d1e76a82b5eac2115525496a63c2e43 (patch)
tree388d41f238a4c84ca07276a1def0531574845ae5
parent38af7c6bcda2b306e3f50ab9a3690e5e03af0a83 (diff)
Fix setting QTDIR after LocalDebuggerEnvironment in the .user file
In VS2013/15, if the LocalDebuggerEnvironment property is already defined when setting the QTDIR property, then it will be stored in the .user file before the QTDIR property, which is an error because there is a dependency. To work around this, we first remove the property and then add it after QTDIR is set. Task-number: QTVSADDINBUG-363 Change-Id: Iddeb27e5d719c3da6623dbcee735b7f3fc4b3604 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/qtprojectlib/QtProject.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/qtprojectlib/QtProject.cs b/src/qtprojectlib/QtProject.cs
index d05a22b8..9fd860d0 100644
--- a/src/qtprojectlib/QtProject.cs
+++ b/src/qtprojectlib/QtProject.cs
@@ -2840,7 +2840,29 @@ namespace QtProjectLib
var cur_platform = conf.Platform as VCPlatform;
if (cur_platform.Name == activePlatformName) {
var cur_solution = conf.ConfigurationName + "|" + cur_platform.Name;
+#if VS2013 || VS2015
+ // In VS2013/15, if the LocalDebuggerEnvironment property is defined, it
+ // will be stored in the .user file before the QTDIR property, which is an
+ // error because there is a dependency. To work around this, first remove
+ // the property and then add it after QTDIR is defined.
+ string debuggerEnv = propertyAccess.GetPropertyValue(
+ "LocalDebuggerEnvironment", cur_solution, "UserFile");
+ if (!string.IsNullOrEmpty(debuggerEnv)) {
+ var debugSettings = conf.DebugSettings as VCDebugSettings;
+ if (debugSettings != null) {
+ //Get original value without expanded properties
+ debuggerEnv = debugSettings.Environment;
+ }
+ propertyAccess.RemoveProperty(
+ "LocalDebuggerEnvironment", cur_solution, "UserFile");
+ }
+#endif
propertyAccess.SetPropertyValue("QTDIR", cur_solution, "UserFile", qtDir);
+#if VS2013 || VS2015
+ if (!string.IsNullOrEmpty(debuggerEnv))
+ propertyAccess.SetPropertyValue(
+ "LocalDebuggerEnvironment", cur_solution, "UserFile", debuggerEnv);
+#endif
}
}