Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot create Nuget package that has xunit as dependency

Steps

  1. Create a new .NETStandard 2.0 project e.g ClassLibrary1
  2. Add xunit package as dependency
  3. Open the command prompt and go to the location
  4. Execute following two commands to create package

Please check dotnet pack for more details

dotnet build /p:SourceLinkCreate=true -v:n -c:Release -p:ci=true

dotnet pack -v:n -c=Release --no-build --include-source --include-symbols --output .\bin

Result: Package not created

Instead of xunit if you add any other dependency it works, for example NUnit and test framework, or Newtonsoft.Json. I have also tried with msbuild command, same result

Is there anything I am missing, or it's a bug?

like image 722
MJK Avatar asked Jan 18 '18 11:01

MJK


Video Answer


1 Answers

This github issue says the behaviour is by design and your library needs the IsPackable setting in .csproj:

<Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="15.0">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <IsPackable>true</IsPackable>
    ...
like image 76
Justinas Marozas Avatar answered Sep 28 '22 12:09

Justinas Marozas