Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to build C# project


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 ========== 
like image 688
Nick Prozee Avatar asked Sep 09 '15 08:09

Nick Prozee


People also ask

Why my CodeBlocks Cannot build?

It is generally due to non availability of compiler or Codeblocks is not properly configured to use the compiler. Best way is to uninstall the current codeblocks and download the version with compiler included. It will be around 80–100MB in size. Install it and most probably your problem will be solved.

Why is my C program not building in CodeBlocks?

Make sure you have installed the GCC version based setup from the official website of Codeblocks, Since the earlier versions were not provided with GCC and Other compilers hence the end user had to download and setup separately, Which again seems to be an hassle of its own when you are too excited to start coding.

What is build in C?

C Build Process is the process of converting the high level source code representation of your embedded software into an executable binary image. This Process involves many steps and tools but the main three distinct steps of this process are: Each of the source files must be compiled or assembled into an object file.


2 Answers

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.

like image 146
amit dayama Avatar answered Oct 02 '22 12:10

amit dayama


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.

like image 22
The Senator Avatar answered Oct 02 '22 14:10

The Senator