@@ -25,6 +25,14 @@ public class DowngradeProjects : Task {
2525 [ Required ]
2626 public ITaskItem [ ] Projects { get ; set ; }
2727
28+ /// <summary>
29+ /// Gets or sets a value indicating whether project files are downgraded and re-saved to the same paths.
30+ /// </summary>
31+ public bool InPlaceDowngrade { get ; set ; }
32+
33+ /// <summary>
34+ /// Gets or sets the set of newly created project files. Empty if <see cref="InPlaceDowngrade"/> is <c>true</c>.
35+ /// </summary>
2836 [ Output ]
2937 public ITaskItem [ ] DowngradedProjects { get ; set ; }
3038
@@ -44,9 +52,12 @@ public override bool Execute() {
4452 switch ( GetClassification ( taskItem ) ) {
4553 case ProjectClassification . VS2010Project :
4654 case ProjectClassification . VS2010Solution :
47- string projectNameForVS2008 = Path . Combine (
48- Path . GetDirectoryName ( taskItem . ItemSpec ) ,
49- Path . GetFileNameWithoutExtension ( taskItem . ItemSpec ) + "-vs2008" + Path . GetExtension ( taskItem . ItemSpec ) ) ;
55+ string projectNameForVS2008 = InPlaceDowngrade
56+ ? taskItem . ItemSpec
57+ : Path . Combine (
58+ Path . GetDirectoryName ( taskItem . ItemSpec ) ,
59+ Path . GetFileNameWithoutExtension ( taskItem . ItemSpec ) + "-vs2008" +
60+ Path . GetExtension ( taskItem . ItemSpec ) ) ;
5061 newProjectToOldProjectMapping [ taskItem . ItemSpec ] = projectNameForVS2008 ;
5162 break ;
5263 }
@@ -131,7 +142,11 @@ public override bool Execute() {
131142 }
132143 }
133144
134- this . DowngradedProjects = createdProjectFiles . ToArray ( ) ;
145+ if ( InPlaceDowngrade ) {
146+ this . DowngradedProjects = new ITaskItem [ 0 ] ;
147+ } else {
148+ this . DowngradedProjects = createdProjectFiles . ToArray ( ) ;
149+ }
135150
136151 return ! this . Log . HasLoggedErrors ;
137152 }
0 commit comments