【问题标题】:Command line MSBuild fails to compile code命令行 MSBuild 无法编译代码
【发布时间】:2016-07-03 01:30:27
【问题描述】:

谁能告诉我为什么命令行 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.Authentication​n.UserNameHandlers;

想法?

【问题讨论】:

    标签: c# command-line compilation compiler-errors msbuild


    【解决方案1】:

    您在Authentication 中的on 之间有一个不可显示的字符。 用键盘上的方向键玩就可以看到。

    【讨论】:

    • 朋友,我欠你一杯啤酒! :) 我已经转了几个小时了。为了确认您的解决方案,我删除并重写了代码。它现在似乎可以工作了!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-09
    • 1970-01-01
    • 2017-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多