c# - 为 C# 安装 Graphhopper Directions API 客户端期间出现错误
问题描述
我想使用通过这个 git repo提供的 C# 的 Graphhopper API 客户端库
我按照自述文件提出了以下错误。
在运行 build.bat 时,我收到以下错误:
...\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
...
我没有更改direction-api-clients 目录中的任何文件。我按照自述文件中的说明进行操作。
如果我是对的,我的编译器或某些需求版本已经过时,所以我无法正确编译必要的文件。我对 C# 开发还很陌生,到目前为止,我自己无法找出错误。也许你可以指出我正确的方向。
此致。最佳答案的 Cookie :)
更新:
我使用最新的 C# 编译器并再次运行 build.bat 文件。这给了我一些改变,但仍然失败并出现错误:
../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.
帮助表示赞赏。饼干供应
更新 2:
按照jdweng的建议。非常感谢您的支持。
使用干净的 bin 目录重建并没有修复错误。bin 目录下没有调试和发布文件夹。
csproj 文件包括:
<?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>
到目前为止,我无法从该文件中获得有价值的信息。我将尝试通过邮件联系 graphhopper 支持。
我将继续为那些对此问题感兴趣的人更新此线程。
解决方案
推荐阅读
- delphi - 使用 indy UDP 客户端 (delphi) 实现 DTLS
- amazon-web-services - 将文件直接从远程 url 传输到 S3 Bucket
- mysql - 使用 ADODB.Parameter 获取两个日期之间的值
- c# - C# Z 索引窗口窗体
- c++ - 在 C++ 规范中定义的 for 循环头中声明循环索引的行为?
- css - 移动设备上的 CSS 工具提示不会在第二次按下时关闭
- amazon-web-services - AWS SQS FIFO 队列仍然要求消费者是幂等的?
- python - 将华氏度转换为摄氏度不断获得 0 的列表?
- sql - 查询中小时的平均数据
- c++ - 有没有其他方法可以在不使用数组的情况下按升序或降序对数字进行排序?