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 @@ -8,7 +8,7 @@ namespace UsingMSBuildCopyOutputFileToFastDebug
88{
99 public class Program
1010 {
11- static void Main ( string [ ] args )
11+ static int Main ( string [ ] args )
1212 {
1313#if DEBUG
1414 Logger . Message ( $ "UsingMSBuildCopyOutputFileToFastDebug { Environment . CommandLine } ") ;
@@ -30,21 +30,29 @@ static void Main(string[] args)
3030 // 还好上面代码不在乎性能,让我试试这个逗比方法
3131 }
3232
33- CommandLine . Parse ( args ) . AddHandler < CleanOptions > ( c =>
33+ try
3434 {
35- Logger . Message ( $ "Enter CleanOptions") ;
36- } )
37- . AddHandler < CopyOutputFileOptions > ( c =>
38- {
39- Logger . Message ( $ "Enter CopyOutputFileOptions") ;
40- CopyOutputFile ( c ) ;
41- } )
42- . Run ( ) ;
35+ return CommandLine . Parse ( args ) . AddHandler < CleanOptions > ( c =>
36+ {
37+ Logger . Message ( $ "Enter CleanOptions") ;
38+ } )
39+ . AddHandler < CopyOutputFileOptions > ( c =>
40+ {
41+ Logger . Message ( $ "Enter CopyOutputFileOptions") ;
42+ CopyOutputFile ( c ) ;
43+ } )
44+ . Run ( ) ;
45+ }
46+ catch ( Exception e )
47+ {
48+ Logger . Error ( e . ToString ( ) ) ;
49+ return - 1 ;
50+ }
4351 }
4452
4553 private static void CopyOutputFile ( CopyOutputFileOptions copyOutputFileOptions )
4654 {
47-
55+
4856 }
4957
5058 /// <summary>
@@ -56,7 +64,7 @@ private static DirectoryInfo GetTargetFolder(CopyOutputFileOptions copyOutputFil
5664 {
5765 var mainProjectPath = copyOutputFileOptions . MainProjectPath ;
5866 // 如果用户有设置此文件夹,那就期望是输出到此文件夹
59- if ( ! string . IsNullOrEmpty ( mainProjectPath ) )
67+ if ( ! string . IsNullOrEmpty ( mainProjectPath ) )
6068 {
6169 return new DirectoryInfo ( mainProjectPath ) ;
6270 }
You can’t perform that action at this time.
0 commit comments