40


I am having some weird problem.
When using this code I am unable to build, however it gives me no build errors.

the code

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"];
}

Can anyone tell me why my build braks, and also why no build errors are shown?

UPDATE - Output
*Also changed var to string

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 ==========
11
  • 1
    Did you try restarting VS? Commented Sep 9, 2015 at 8:50
  • 2
    You explain what does it mean: it cannot build but I have no errors? It VS doesn't show you errors, check output log Commented Sep 9, 2015 at 8:51
  • 2
    I wonder if it has something to do with using var to refer to an object defined as dynamic? var needs to be able to imply the type at compile time, but dynamic is unknown until runtime. Commented Sep 9, 2015 at 8:56
  • 2
    Where are you looking at "The log"? Added picture shows error window, not "Output Window" - can you look in the output window? Commented Sep 9, 2015 at 9:02
  • 2
    Now the error is clear and it looks like you forgot to add the Microsoft.CSharp.dll to your project. Did you convert it from a previous version? Check this duplicate question for a similar error Commented Sep 9, 2015 at 9:07

4 Answers 4

114

You have this error in your output:

Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'

You need to add a reference to the DLL Microsoft.CSharp.dll.

Sign up to request clarification or add additional context in comments.

4 Comments

Problem solved for me when I added System.Core in-addition to Microsoft.CSharp
I have to add Nuget.CSharp in xamarin.Forms project as projects target .Net core 2.x and CSharp assembly cannot be explicitly added to portable project. worked.
I use the same why from Sakthivel by adding Microsoft.CSharp from nuget to the .net standard project to fix this issue
I added the Nuget Package Microsoft.CSharp, but I have the same error.
16

As similar to Saminathan S's comment in the accepted answer. If you are using .NETStandard projects (in my case NETStandard 2.0) you need to add Microsoft.CSharp from NuGet rather than as a reference in order to resolve this build error. I was using Visual Studio Community on a Mac.

2 Comments

Same for me in VS2017 Professional on Windows. Why this wasn't included in the project template remains a mystery.
Same for me using VS2019 Community on Windows x64 with NETStandard2.0.
9

Quick solution.

Right click on Packages > Add NuGet Packages... > Microsoft.CSharp

This worked for me. [Mac, Visual Studio 2017 Community]

Comments

2

You can also edit your .csproj file adding this, which has the same result as @the-senator said:

<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.