graphhopper / directions-api-clients

API clients for various languages for the GraphHopper Directions API
https://docs.graphhopper.com/
Apache License 2.0
30 stars 39 forks source link

Errors when running the build.bat script for C# API Client #40

Open bouldrini opened 4 years ago

bouldrini commented 4 years ago

I followed the Readme and came up with the following error.

While running build.bat I receive the following Errors:

...\directions-api-clients\csharp>build.bat

Feeds used:
  C:\Users\xx\.nuget\packages\
  https://api.nuget.org/v3/index.json
  C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

All packages listed in "..\directions-api-clients\csharp\src\GraphHopper\packages.config" are already installed.
        1 File copied.
        1 File copied.
        1 File copied.
Microsoft (R) Visual C# Compiler version 4.8.3752.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

src\IO.Swagger\Api\MatrixApi.cs(35,38): error CS1001: Identifier expected
src\IO.Swagger\Api\MatrixApi.cs(46,63): error CS1001: Identifier expected
...

I didnt alter any file in the direction-api-clients directory. I followed the instructions given in ReadMe File and used swagger.IO editor to generate client for csharp.

If I'm right, my compiler or some requirement version is outdated, so I'm not able to compile the necessary files correctly. I'm pretty new to C# development, and wasn't able to figure out the error by myself so far. Maybe you can point me to the right direction.

Best regards

UPDATE:

I used the latest C# compiler and ran build.bat file again. This gave me some changes, but still fails with errors:

../graphhopper_csharp_client>build.bat
All packages listed in "C..\graphhopper_csharp_client\src\IO.Swagger\packages.config" are already installed
..\graphhopper_csharp_client>if not exist ".\bin" mkdir bin

        1 file copied
        1 file copied
        1 file copied

..\graphhopper_csharp_client>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn"\csc /langversion:8.0  /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll  /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml
Microsoft (R) Visual C# Compiler Version 3.4.1-beta4-19607-02 (52d275c4)
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

src\IO.Swagger\Model\Service.cs(77,299): error CS1525: Invalid Expression "[".
src\IO.Swagger\Model\Service.cs(138,29): error CS1525: Invalid Expression "[".
src\IO.Swagger\Model\RouteResponsePath.cs(46,179): error CS1001: Identifier expected.
...

I forgot to mention: Windows 10 .NET Version should be 4.0 (as said, I'm pretty new to all this. Hopefully I checked it correctly) C# Compiler Version seems to be latest now. Language Version should be 8.0

We are going to use GraphHopper in a commercial application while paying for usage. Support is appreciated.

sunildarji811 commented 3 years ago

@bouldrini You can try rebuilding C# client using latest swagger JOSN/YAML file for graphhopper and then resolve bug in C# project one by one. I hope it will works for you.