title: 'IServiceCollection' does not contain a definition for 'AddApiVersioning' using dot net 5 for a webapi vs code project
body: <p>I am trying to use versioning (Microsoft.AspNet.WebApi.Versioning) with dotnet 5 for a webapi project. I have added the nuget package but get the following error:</p>
  <p><em><strong>'IServiceCollection' does not contain a definition for 'AddApiVersioning' and no accessible extension method 'AddApiVersioning' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)</strong></em></p>
  <p>on this line:</p>
  <pre><code>services.AddApiVersioning();
  </code></pre>
  <p>in my Startup.cs</p>
  <p>My .csproj file looks like this:</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk.Web&quot;&gt;
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;net5.0&lt;/TargetFramework&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Microsoft.Identity.Web&quot; Version=&quot;1.0.0&quot;/&gt;
      &lt;PackageReference Include=&quot;Microsoft.Identity.Web.UI&quot; Version=&quot;1.0.0&quot;/&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore&quot; Version=&quot;5.6.3&quot;/&gt;
      &lt;PackageReference Include=&quot;Microsoft.Data.SqlClient&quot; Version=&quot;2.0.1&quot;/&gt;
      &lt;PackageReference Include=&quot;Dapper&quot; Version=&quot;2.0.35&quot;/&gt;
      &lt;PackageReference Include=&quot;Azure.Storage.Blobs&quot; Version=&quot;12.4.1&quot;/&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNet.WebApi.Versioning&quot; Version=&quot;4.1.1&quot;/&gt;
    &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p>I tried to follow some examples, like <a href="https://www.jasongaylord.com/blog/2020/09/18/versioning-rest-api-using-aspnet-core" rel="nofollow noreferrer">this one</a> and <a href="https://www.infoworld.com/article/3562355/how-to-use-api-versioning-in-aspnet-core.html" rel="nofollow noreferrer">this one</a> and <a href="https://dotnetdetail.net/implement-api-versioning-in-asp-net-core-5-web-api/" rel="nofollow noreferrer">this one</a>, I should have the following 'using directive', which I have:</p>
  <pre><code>using Microsoft.AspNetCore.Mvc;
  </code></pre>
  <p>Is anybody having the same challenge? Is Versioning supported yet in .net 5?</p>