aspnet / Mvc

[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ApiConventionType all of a sudden states assembly reference cannot be found

DanJ210 opened this issue · comments

Is this a Bug or Feature request?:

Bug

Steps to reproduce (preferably a link to a GitHub repo with a repro project):

Description of the problem:

I have had the Microsoft.AspNetCore.Mvc.Api.Analyzers NuGet package installed for quite a bit with no problems. All of a sudden there's build errors and it's showing the [ApiConventionType(typeof(DefaultApiConventions))] line of code is errored out stating it's not referenced. I don't understand what has happened I've just been building the methods within the Web API that I've been producing.

Version of Microsoft.AspNetCore.Mvc or Microsoft.AspNetCore.App or Microsoft.AspNetCore.All:

Microsoft.AspNetCore.App: 2.1.6

commented

Thank you for filing this issue. In order for us to investigate this issue, please provide a minimalistic repro project that illustrates the problem.

Ok but I'm assuming that you realize this is specific to an environment and a repo won't reproduce the same issue unless the same random thing can happen and you keep the repo on your machine checking it everyday to see when the above issue happens.

Are you sure this is the best way to understand above? If Microsoft.AspNetCore.Mvc.Api.Analyzers is added to the project, shouldn't the above line of code work? [ApiConventionType(typeof(DefaultApiConventions))]

That line of code worked for a while and then all of a sudden was errored as not referenced. Should that happen when Microsoft.AspNetCore.Mvc.Api.Analyzers is referenced?

Does the .Net Core project have to be 2.2? I'm able to install the analyzers on 2.1, is that the problem?

commented

@DanJ210, ApiConventionTypeAttribute has been introduced in 2.2, so yes, you should be on 2.2 to be able to use it.

commented

And yes, as you're targeting 2.1.6 it should not be available.