I'm a C# newbie, so bear with me. I'm running the latest dotnet Docker container with the dotnet command line tools, and am attempting to also use RestSharp to do REST requests to a remote API. I managed to get RestSharp added to my project.json, and a 'dotnet restore' completed with no error messages, but when I try to actually use RestSharp in a controller, I get this error:
/path/to/MyController.cs(18,30): error CS0012: The type 'Uri' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Compilation failed.
I know that this is happening as a result of RestSharp because when I comment out all the RestSharp code the error message goes away.
I'm thinking it probably has something to do with my project.json
file, which I'll paste at the end of this message. For those of us using Linux, we don't have access to NuGet, and we have to create our project.json
files by hand. This one was originally created by a yeoman
scaffolder for dotnet.
Thanks for your help!
{ "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0", "type": "platform" }, "Microsoft.AspNetCore.Mvc": "1.0.1", "Microsoft.AspNetCore.Routing": "1.0.1", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Logging.Debug": "1.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", }, "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", "Microsoft.DotNet.Watcher.Tools": "1.1.0-preview4-final" }, "frameworks": { "netcoreapp1.0": { "dependencies": { "RestSharp": "105.2.3", "System.Net.Http": "4.3.0", "System.Runtime": "4.3.0" }, "frameworkAssemblies": { }, "imports": [ "net452", "dotnet5.6", "portable-net45+win8" ], } }, "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true }, "runtimeOptions": { "configProperties": { "System.GC.Server": true } }, "publishOptions": { "include": [ "wwwroot", "**/*.cshtml", "appsettings.json", "web.config" ] }, "scripts": { "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] }, "tooling": { "defaultNamespace": "WebAPIApplication" }