dotnet pack with paket fails on core 2.1 - The licenseUrl and license elements cannot be used together

105 Views Asked by At

dotnet pack with paket fails with The licenseUrl and license elements cannot be used together

This error is due to changes in dotnetCore SDKs between versions 2.1 and 2.2

Unfortunately, on my Jenkins agents there is only core 2.1 - I started nagging tools people to install 2.2 on them, but in the mean time, is there a way to make it work on 2.1?

I have to use Directory.build.propsas below, because it is part of a template for repositories on our new Jenkins infrastructure and it is overriden on checkout to set the versions

<Project>
    <PropertyGroup>
        <!-- NuGet -->
        <IsPackable>True</IsPackable>
        <PackageVersion>0.1.5-local</PackageVersion>
        <NuspecProperties>version=$(PackageVersion);licensePath=$(MSBuildThisFileDirectory)LICENSE.txt</NuspecProperties>
        <PackageOutputPath>$(MSBuildThisFileDirectory)Artifacts\NuGet\</PackageOutputPath>
        <PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
        <!-- Build standards -->
        <OutputPath>bin\</OutputPath>
        <!-- Assembly information -->
        <FileVersion>0.1.5</FileVersion>
        <InformationalVersion>local build</InformationalVersion>
        <AssemblyVersion>0.1.5</AssemblyVersion>
        <Copyright>Some company</Copyright>
        <Company>Some company</Company>
    </PropertyGroup>
    <ItemGroup>
        <None Include="$(MSBuildThisFileDirectory)LICENSE.txt" Pack="true" PackagePath="$(PackageLicenseFile)"/>
    </ItemGroup>
</Project>

I made a repro repo that shows the issue. I cannot edit Directory.Build.prop, only the csproj.

Is there a flag or maybe even older paket version that would work here?

https://github.com/qrzychu/paket_repro

https://github.com/fsprojects/Paket/issues/3657

1

There are 1 best solutions below

0
On

It turns out that the braking changes in dotnet were in 2.1, so updating to 2.1.802 makes it magically work