简体   繁体   中英

Build error on Azure DevOps but not local

I have following errors on Azure DevOps:

Floow.Admin.Domain.Attributes\ServiceDocumentFieldAttribute.cs(38,30): Error CS1002: ; expected Floow.Admin.Domain.Attributes\ServiceDocumentFieldAttribute.cs(38,43): Error CS1519: Invalid token '(' in class, struct, or interface member declaration

It is about following code

public class GridFilterAttribute : Attribute
{
    public readonly string[] Fields;
    public bool IsFilter => Fields.Any();
    public GridFilterAttribute(params string[] fields)
    {
        Fields = fields;
    }        
}

Could this have to do with the C# version? Local no problems.

########################## New information ##########################

Could this be a reason: ##error]packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets(48,5): Error MSB4062: The "KillProcess" task could not be loaded from the assembly c:\agent\2\s\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\build\net46....\tasks\DotNetCompilerPlatformTasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Compiler Error CS1519

Invalid token 'token' in class, struct, or interface member declaration

This error is generated whenever a token is encountered in a location where it does not belong. A token is a keyword; an identifier (the name of a class, struct, method, and so on); a string, character, or numeric literal value such as 108, "Hello", or 'A'; or an operator or punctuator such as == or ; .

Any class, struct, or interface member declaration that contains invalid modifiers before the type will generate this error. To fix the error, remove the invalid modifiers.

The following sample generates CS1519 in five places because tokens are placed in locations where they are not valid:

// CS1519.cs  
// Generates CS1519 because a class name cannot be a number:  
class Test 42
{  
// Generates CS1519 because of 'j' following 'I'  
// with no comma between them:  
    int i j;
// Generates CS1519 because of "checked" on void method:  
    checked void f4();
  
// Generates CS1519 because of "num":  
    void f5(int a num){}
  
// Generates CS1519 because of namespace inside class:  
    namespace;
  
}

So, check out for misplaced tokens in your ServiceDocumentFieldAttribute.cs .

The build server was down. Because we are isolated because of Corona we didn't notice. Now moving to a VPS so we always can access the server. Weird there is no server down error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM