reference error .net 4.6.1 for .netStandart 2.0

0

I have a problem when referencing a Standart2.0 project in my api .net Framework 461;

The following happens I have the class:

public class MeuReturn : IHttpActionResult
{
        private readonly string _objeto;

        public MeuReturn(string objeto)
        {
            _objeto = objeto;
        }
        public Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            HttpResponseMessage response = 
                                        new HttpResponseMessage(HttpStatusCode.BadRequest)
            {
                Content = new StringContent(_objeto)
            };
            return Task.FromResult(response);
        }

}

To perform a custom return, 100% works, but when I refer to the other project and squeeze the API, the following error occurs:

  

An error occurred. Method   ExecuteAsync in WebApplication3.Controllers.MuReturn type of assembly   WebApplication3, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null   does not have an implementation.   System.TypeLoadException   in WebApplication3.Controllers.HomeController.erro () in   lambda_method (Closure, Object, Object []) in   System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.

asked by anonymous 26.10.2017 / 00:47

1 answer

1

Edit the ClassLibrary.csprj, and add the target of your web application. remembering that the tag is in the plural: TargetFramerowk s

    
27.10.2017 / 17:11