Skip to content

Implicit references warning dotnet sdk 2.2.100 #3481

Closed

Description

@seanamosw

Description

When using dotnet sdk >= 2.2.100 adding a reference to Microsoft.AspNetCore.App in paket.dependencies/paket.references for a project results in a warning:

/usr/local/share/dotnet/sdk/2.2.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets(153,5): error NETSDK1071: A PackageReference to 'Microsoft.AspNetCore.App' specified a Version of `2.1.6`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs [/xxx/xxx.csproj]

Known workarounds

  • Possibly add DisableImplicitFrameworkReferences to the .csproj, this will require explicitly referencing other implicits (netstandard). Update: DisableImplicitFrameworkReferences cannot be used to suppress the warning in this case.

  • Or add a PackageReference for Microsoft.AspNetCore.App without a version specified to the .csproj. You might have to now reference other packages in paket.dependencies/paket.references for paket to resolve dependencies that you were implicitly using through Microsoft.AspNetCore.App.

Activity

  1. seanamosw commented on Jan 16, 2019

    @seanamosw
    ContributorAuthor

    Adding <AllowExplicitVersion>true</AllowExplicitVersion> to the generated PackageReference in Paket.Restore.targets is enough to suppress the warning and control the version of the package.

    <PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
        <Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
        <PrivateAssets Condition=" ('%(PaketReferencesFileLinesInfo.AllPrivateAssets)' == 'true') Or ('$(PackAsTool)' == 'true') ">All</PrivateAssets>
        <ExcludeAssets Condition=" '%(PaketReferencesFileLinesInfo.Splits)' == '6' And %(PaketReferencesFileLinesInfo.CopyLocal) == 'false'">runtime</ExcludeAssets>
        <ExcludeAssets Condition=" '%(PaketReferencesFileLinesInfo.Splits)' != '6' And %(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'exclude'">runtime</ExcludeAssets>
        <Publish Condition=" '$(PackAsTool)' == 'true' ">true</Publish>
        <AllowExplicitVersion>true</AllowExplicitVersion>
    </PackageReference>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions