File tree Expand file tree Collapse file tree
Code/UsingMSBuildCopyOutputFileToFastDebug Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ static int Main(string[] args)
3333
3434 try
3535 {
36- return CommandLine . Parse ( args ) . AddHandler < CleanOptions > ( c => { Logger . Message ( $ "Enter CleanOptions") ; } )
36+ return CommandLine . Parse ( args ) . AddHandler < CleanOptions > ( c =>
37+ {
38+ Logger . Message ( $ "Enter CleanOptions") ;
39+ CleanFile ( c ) ;
40+ } )
3741 . AddHandler < CopyOutputFileOptions > ( c =>
3842 {
3943 Logger . Message ( $ "Enter CopyOutputFileOptions") ;
@@ -48,6 +52,35 @@ static int Main(string[] args)
4852 }
4953 }
5054
55+ private static void CleanFile ( CleanOptions cleanOptions )
56+ {
57+ try
58+ {
59+ var cleanFileList = File . ReadAllLines ( cleanOptions . CleanFilePath ) ;
60+ foreach ( var file in cleanFileList )
61+ {
62+ try
63+ {
64+ if ( File . Exists ( file ) )
65+ {
66+ File . Delete ( file ) ;
67+ Logger . Message ( $ "Deleted files: { file } ") ;
68+ }
69+ }
70+ catch
71+ {
72+ // 删除失败忽略
73+ }
74+ }
75+
76+ File . Delete ( cleanOptions . CleanFilePath ) ;
77+ }
78+ catch
79+ {
80+ // 删除失败忽略
81+ }
82+ }
83+
5184 private static void CopyOutputFile ( CopyOutputFileOptions copyOutputFileOptions )
5285 {
5386 var launchMainProjectExecutableFile = GetLaunchMainProjectExecutablePath ( copyOutputFileOptions ) ;
Original file line number Diff line number Diff line change 11<Project >
22 <PropertyGroup >
3- <Version >1.3.215 </Version >
3+ <Version >1.3.216 </Version >
44 </PropertyGroup >
55</Project >
You can’t perform that action at this time.
0 commit comments