Swashbuckle.aspnetcore: Support for .NetCoreApp 1.1

Created on 10 May 2017  路  5Comments  路  Source: domaindrivendev/Swashbuckle.AspNetCore

I'm trying to add Swashbuckle to a new .NET Core 1.1 Web API app, using VS Code as an IDE. When I run the command:

dotnet add package Swashbuckle.AspNetCore -v 1.0.0-*

I get the response:

$ dotnet add package Swashbuckle.AspNetCore -v 1.0.0-*
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.

  Writing C:\Users\bpowell\AppData\Local\Temp\tmpAE3D.tmp
info : Adding PackageReference for package 'Swashbuckle.AspNetCore' into project 'C:\code\services\telemetry\*********.Services.Telemetry.csproj'.
log  : Restoring packages for C:\code\services\telemetry\*********.Services.Telemetry.csproj...
info :   GET http://nuget.cf.********.net/nuget/FindPackagesById()?id='Swashbuckle.AspNetCore'
info :   OK http://nuget.cf.*******.net/nuget/FindPackagesById()?id='Swashbuckle.AspNetCore' 51ms
error: Unable to resolve 'Swashbuckle.AspNetCore (>= 1.0.0)' for '.NETCoreApp,Version=v1.1'.
error: Package 'Swashbuckle.AspNetCore' is incompatible with 'all' frameworks in project 'C:\code\services\telemetry\*********.Services.Telemetry.csproj'.

My project file looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="wwwroot\"/>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.1"/>
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2"/>
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1"/>
    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.1"/>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1"/>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0"/>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1"/>  
  </ItemGroup>
</Project>

I'm aware that this issue appears to be similar to a couple of other issues, #232 and #239, but they don't seem to address this specific issue.

Please let me know if there's any other information I can provide, or anything else I can do to help. If I get some time later this week I'll try a few other things, but requests from Product Managers wait for no man...

Most helpful comment

Solution (workaround) found

OK - For anyone else who might have the same issue, the problem may lie with the source you are using for the NuGet packages. I've managed to get it to restore without issue by specifying the exact source:

dotnet add package Swashbuckle.AspNetCore -s https://api.nuget.org/v3/index.json

If you use the older v2 source it doesn't work. I've not figured out how to tell 'dotnet add package' to use a different Nuget.config file, and if I add a .nuget folder and Nuget.Config file to my solution, it doesn't get used. So it looks like the workaround is to use the '-s' flag and specify the v3 package source manually.

All 5 comments

Incidentally, I've also tried adding it manually, setting the version to '1.0.0', leaving the version out, etc.

Actually, you know when you post something, then read it again, and then realise there's something you haven't done correctly... that. I'm wondering if it's because I'm not looking at the standard nuget repository. I'll reset the config and try again.

OK It's not that. I'm looking at the NuGet page for the Swashbuckle.AspNetCore ([https://www.nuget.org/packages/Swashbuckle.AspNetCore/]) and it looks like the dependencies are set to the wrong frameworks for .NET Core - being the 451 framework and the standard 1.6 framework. Could you take a look please?

OK, might be an issue with NuGet rather than this package, as I'm seeing the same issue with FluentValidation.AspNetCore, and I found this issue Package 'NameOfPackage' is incompatible with 'all' frameworks in project which seems to be the same thing I'm seeing.

Solution (workaround) found

OK - For anyone else who might have the same issue, the problem may lie with the source you are using for the NuGet packages. I've managed to get it to restore without issue by specifying the exact source:

dotnet add package Swashbuckle.AspNetCore -s https://api.nuget.org/v3/index.json

If you use the older v2 source it doesn't work. I've not figured out how to tell 'dotnet add package' to use a different Nuget.config file, and if I add a .nuget folder and Nuget.Config file to my solution, it doesn't get used. So it looks like the workaround is to use the '-s' flag and specify the v3 package source manually.

Was this page helpful?
0 / 5 - 0 ratings