0

I would like to use the Graphhopper API Client library for C# provided through this git repo

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\richard.wieditz\.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\GraphHopper\Api\MatrixApi.cs(35,38): error CS1001: Identifier expected
src\GraphHopper\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.

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. Cookies for best anwsers :)

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 Datei(en) kopiert.
        1 Datei(en) kopiert.
        1 Datei(en) kopiert.

..\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: Ungültiger Ausdruck "[".
src\IO.Swagger\Model\Service.cs(138,29): error CS1525: Ungültiger Ausdruck "[".
src\IO.Swagger\Model\RouteResponsePath.cs(46,179): error CS1001: Bezeichner erwartet.

Help is appreciated. Cookie offering

UPDATE 2:

Following the suggestions by jdweng. Thank you very much for your support.

Rebuilding with clean bin directory didnt fix the errors. There is no debug and release folder in the bin directory.

The csproj file includes:

<?xml version="1.0" encoding="utf-8"?>
<!--
GraphHopper Directions API
OpenAPI spec version: 1.0.0
Contact: support@graphhopper.com
-->

<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>

    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{E2A74D10-5F6F-48B7-A2F7-56CD372CB223}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>IO.Swagger</RootNamespace>
    <AssemblyName>IO.Swagger</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Xml" />
    <Reference Include="Newtonsoft.Json">
      <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
      <HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
      <HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
      <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="JsonSubTypes">
      <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
      <HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
      <HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
      <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
    </Reference>
    <Reference Include="RestSharp">
        <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
        <HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
        <HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
      <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="**\*.cs"
             Exclude="obj\**" />
  </ItemGroup>
  <ItemGroup>
      <None Include="packages.config" />
  </ItemGroup>
  <Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

I am not able to gain valuable information from this file so far. I will try to contact graphhopper support via mail.

I will keep updating this thread for those who are interested in this issue as well.

Richard Wieditz
  • 406
  • 1
  • 4
  • 14
  • 1
    Open the bat file with notepad and read the comments. – jdweng Jan 15 '20 at 18:13
  • Unluckily there are no comments attached to any files. – Richard Wieditz Jan 16 '20 at 08:01
  • 1
    Check the dates of the files in the bin folder to see if they were updated. I suspect not all the files in the bin folder are getting updated. I would make a copy of the bin folder and then delete which should force everything to get compiled. You could try a clean build first. The build process copies all the dlls into the bin folder and then creates the .exe. The bin folder usually has a debug and a release folder. The csproj (text file) has the build instructions. So I suspect something is wrong either in the bin or the csproj that is not updating all the files in the bin folder. – jdweng Jan 16 '20 at 10:40

0 Answers0