Ответ 1
У вас есть эта ошибка в вашем выходе:
Отсутствует обязательный элемент компилятора 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
Вам нужно добавить ссылку на DLL Microsoft.CSharp.dll.
У меня возникла какая-то странная проблема.
При использовании этого кода я не могу построить, однако он не дает мне ошибок сборки.
код
public void myMethod()
{
//This returns a string in JSON format.
var jsonResponse = myApi.ReadMobileDevice("1");
dynamic dynamicJson= JsonConvert.DeserializeObject(jsonResponse);
//THIS LINE BREAKS MY BUILD. NO BUILD ERRORS SHOWN
var jValue = dynamicJson["general.display_name"];
}
Может ли кто-нибудь сказать мне, почему мои блокировки сборки, а также почему не отображаются ошибки сборки?
UPDATE - вывод
* Также изменил var на строку
1>------ Build started: Project: Control, Configuration: Debug x86 ------
1> Restoring NuGet packages...
1> To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
1> All packages listed in packages.config are already installed.
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(563,28,563,40): error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
1>C:\ActacomProjects\DEV-Google\Control\Classes\DomainObjects\Schedules\HTTPSchedulesResponse.cs(41,34,41,36): warning CS0168: The variable 'Ex' is declared but never used
1>C:\ActacomProjects\DEV-Google\Control\Classes\DomainObjects\Schedules\HTTPSchedulesResponse.cs(87,30,87,32): warning CS0168: The variable 'Ex' is declared but never used
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(1225,26,1225,45): warning CS0219: The variable 'recreateApplication' is assigned but its value is never used
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(1809,71,1809,74): warning CS0168: The variable 'dnf' is declared but never used
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(1813,54,1813,56): warning CS0168: The variable 'ex' is declared but never used
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(5017,34,5017,36): warning CS0168: The variable 'Ex' is declared but never used
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(5087,42,5087,44): warning CS0168: The variable 'Ex' is declared but never used
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(5154,42,5154,44): warning CS0168: The variable 'Ex' is declared but never used
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(5192,42,5192,44): warning CS0168: The variable 'Ex' is declared but never used
1>C:\ActacomProjects\DEV-Google\Control\ModifyService.svc.cs(5267,42,5267,44): warning CS0168: The variable 'Ex' is declared but never used
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
У вас есть эта ошибка в вашем выходе:
Отсутствует обязательный элемент компилятора 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
Вам нужно добавить ссылку на DLL Microsoft.CSharp.dll.
Как и в Saminathan S комментарий в принятом ответе. Если вы используете проекты .NETStandard (в моем случае NETStandard 2.0), вам нужно добавить Microsoft.CSharp из NuGet, а не как ссылку, чтобы устранить эту ошибку сборки. Я использовал Visual Studio Community на Mac.
Вы также можете отредактировать файл .csproj, добавив его, что дает тот же результат, что и @the-senator сказал:
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
Быстрое решение.
Щелкните правой кнопкой мыши Packages
> Add NuGet Packages...
> Microsoft.CSharp
Это сработало для меня. [Mac, сообщество Visual Studio 2017]