2016-03-16 148 views
0

任何人都可以告訴我爲什麼命令行msbuild無法構建此代碼?命令行MSBuild無法編譯代碼

public SourceControlHandler(string sourceControlUser = null, string sourceControlPassword = null, string sourceControlDomain = null) 
     {  
      var client = new SvnClient(); 
      if (!string.IsNullOrEmpty(SourceControlUser) && !string.IsNullOrEmpty(SourceControlPassword)) 
      { 
       client.Authentication.Clear(); 
       client.Authenticatio​n.UserNameHandlers += delegate (object sender, Sv​nUserNameEventArgs e) 
       { 
        e.UserName = SourceControlUser; 
       }; 
      _svnClient = client; 
     } 

的錯誤是:

d:\DEV\EP.BuildAndDeploy\BuildResources\BuildProjects.build" (Rebuild target) 
1) -> 
D:\DEV\EP.BuildAndDeploy\EP.BuildService\EP.BuildService.csproj" (default targ 
t) (5) -> 
CoreCompile target) -> 
Handlers\SourceControlHandler.cs(44,39): error CS1002: ; expected [D:\DEV\EP. 
uildAndDeploy\EP.BuildService\EP.BuildService.csproj] 
Handlers\SourceControlHandler.cs(44,39): error CS1525: Invalid expression ter 
'.' [D:\DEV\EP.BuildAndDeploy\EP.BuildService\EP.BuildService.csproj] 
Handlers\SourceControlHandler.cs(44,40): error CS1002: ; expected [D:\DEV\EP. 
uildAndDeploy\EP.BuildService\EP.BuildService.csproj] 
Handlers\SourceControlHandler.cs(44,107): error CS1026:) expected [D:\DEV\EP 
BuildAndDeploy\EP.BuildService\EP.BuildService.csproj] 
Handlers\SourceControlHandler.cs(44,108): error CS1002: ; expected [D:\DEV\EP 
BuildAndDeploy\EP.BuildService\EP.BuildService.csproj] 
Handlers\SourceControlHandler.cs(44,108): error CS1525: Invalid expression te 
m ')' [D:\DEV\EP.BuildAndDeploy\EP.BuildService\EP.BuildService.csproj] 
Handlers\SourceControlHandler.cs(44,109): error CS1002: ; expected [D:\DEV\EP 
BuildAndDeploy\EP.BuildService\EP.BuildService.csproj] 
Handlers\SourceControlHandler.cs(48,14): error CS1002: ; expected [D:\DEV\EP. 
uildAndDeploy\EP.BuildService\EP.BuildService.csproj] 
Handlers\SourceControlHandler.cs(50,10): error CS1513: } expected [D:\DEV\EP. 
uildAndDeploy\EP.BuildService\EP.BuildService.csproj] 

的Visual Studio 2015年沒有問題,編譯它,代碼不拋出任何運行時錯誤。 列出的代碼從第38行開始。因此MSBuild/CSC正在抱怨 - 第一個錯誤 - 關於第二個點:client.Authenticatio n.UserNameHandlers;

想法?

回答

1

Authentication之間on之間有一個不可顯示的字符。 使用鍵盤上的箭頭鍵可以看到它。

+0

我的朋友,我欠你一杯啤酒! :)我已經跑了幾個小時。 要確認您的解決方案,我已刪除並重寫了代碼。它似乎正在工作! –