This is a patch for bug 1156702.

 

It adds the “releasesymbols” attribute to the solution task. If set to true and a project in the solution is set to not generate debug information (DebugSymbols is false) then it sets the debug setting to “/debug:pdbonly” instead of “/debug-“. This will generate the pdb file but otherwise leave the assembly as a release build (no debuggable attribute added).

 

Brian Walker

 

Index: ConfigurationSettings.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/ConfigurationSettings.cs,v
retrieving revision 1.28
diff -c -r1.28 ConfigurationSettings.cs
*** ConfigurationSettings.cs    3 Mar 2005 06:49:52 -0000       1.28
--- ConfigurationSettings.cs    4 Mar 2005 18:11:16 -0000
***************
*** 104,110 ****
                      break;
              }
  
-             htBooleanSettings["DebugSymbols"] = "/debug";
              htBooleanSettings["TreatWarningsAsErrors"] = "/warnaserror";
              htBooleanSettings["Optimize"] = "/optimize";
  
--- 104,109 ----
***************
*** 137,142 ****
--- 136,153 ----
                  }
              }
  
+             string debugValue = elemConfig.GetAttribute("DebugSymbols");
+             if (string.Compare(debugValue, "true", true, 
CultureInfo.InvariantCulture) == 0) {
+                 _settings.Add("/debug+");
+             } else if (string.Compare(debugValue, "false", true, 
CultureInfo.InvariantCulture) == 0) {
+                 if (SolutionTask.EnableReleaseSymbols) {
+                     _settings.Add("/debug:pdbonly");
+                 }
+                 else {
+                     _settings.Add("/debug-");
+                 }
+             }
+ 
              _settings.Add(string.Format(CultureInfo.InvariantCulture, 
"/out:\"{0}\"", BuildPath));
          }
  
Index: Tasks/SolutionTask.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/Tasks/SolutionTask.cs,v
retrieving revision 1.45
diff -c -r1.45 SolutionTask.cs
*** Tasks/SolutionTask.cs       18 Dec 2004 15:28:45 -0000      1.45
--- Tasks/SolutionTask.cs       4 Mar 2005 18:11:16 -0000
***************
*** 323,328 ****
--- 323,343 ----
          }
  
          /// <summary>
+         /// Should debug symbols (pdb file) be generated for release builds. 
The default is <see langword="false" />.
+         /// </summary>
+         /// <remarks>
+         /// If a project file specifies that debug information should not be 
generated,
+         /// this flag can override to generate a pdb file without adding debug
+         /// information to the assembly.
+         /// </remarks>
+         [TaskAttribute("releasesymbols", Required = false)]
+         [BooleanValidator()]
+         public bool EnableReleaseSymbols {
+             get { return _enableReleaseSymbols; }
+             set { _enableReleaseSymbols = value; }
+         }
+ 
+         /// <summary>
          /// Gets the list of folders to scan for assembly references.
          /// </summary>
          /// <value>
***************
*** 580,585 ****
--- 595,601 ----
          private WebMapCollection _webMaps;
          private bool _includeVSFolders = true;
          private bool _enableWebDav;
+         private bool _enableReleaseSymbols;
  
          #endregion Private Instance Fields
      }

Reply via email to