Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

dotnet pack on .NETCoreApp3.1 results in a faulty package

$
0
0

Friends,

I'm lost, I'm trying to pack a nuget package for my .net core 3.1 app and i keep getting a faulty package.

I've created a sample scenario, one solution with two projects:

  • Console1 app, .netcore3.1
  • Console2 app, .netstandard2.0

Console1 referencing Console2.

I've tried to create a nuget package for Console1, and when i try to install it on a different console i get an error that Console2 is missing and can't be found:

Severity    Code    Description Project File    Line    Suppression StateError   NU1101  Unable to find package ClassLibrary2. No packages exist with this id in source(s): Temp ConsoleApp7 C:\Users\xxx\source\repos\ConsoleApp7\ConsoleApp7\ConsoleApp7.csproj    1   

I then added the following to the project file (after reading some on google):

<PropertyGroup>    <TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput></PropertyGroup><Target Name="CopyProjectReferencesToPackage" DependsOnTargets="BuildOnlySettings;ResolveReferences"><ItemGroup><!-- Filter out unnecessary files --><_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" /></ItemGroup><!-- Print batches for debug purposes --><Message Text="Batch for .nupkg: ReferenceCopyLocalPaths = @(_ReferenceCopyLocalPaths), ReferenceCopyLocalPaths.DestinationSubDirectory = %(_ReferenceCopyLocalPaths.DestinationSubDirectory) Filename = %(_ReferenceCopyLocalPaths.Filename) Extension = %(_ReferenceCopyLocalPaths.Extension)" Condition="'@(_ReferenceCopyLocalPaths)' != ''" /><ItemGroup><!-- Add file to package with consideration of sub folder. If empty, the root folder is chosen. --><BuildOutputInPackage Include="@(_ReferenceCopyLocalPaths)" TargetPath="%(_ReferenceCopyLocalPaths.DestinationSubDirectory)" /></ItemGroup></Target>

When i look at the package (using package explorer), i see now that the nuget contains the dll of Console2. But still - i get the same error.

I thought, if the dll is there, maybe the dependency is an issue, so i thought maybe i can try to see if i can remove somehow the dependency, added PrivateAssets="all" to the project reference like this:

<ItemGroup><ProjectReference PrivateAssets="all" Include="..\ClassLibrary1\ClassLibrary1.csproj" /></ItemGroup>

When i explore the package now - i see the dependency was removed and still - i get the same error.

What is this, is it really impossible to release nuget packages for .netcoreapp3.1?

PLEASE HELP!Gilad


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>