I have to one library which I want to package and use in other projects. This library has reference to another project, that I do not want to publish as a package. To include it in the package I have added this lines in .cproj file:
<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
</ItemGroup>
</Target>
As a result I have both .dlls in packages lib folder, and this kind of nuspec file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>NugetSample</id>
<version>1.0.1</version>
<authors>NugetSample</authors>
<owners>NugetSample</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework=".NETCoreApp3.1">
<dependency id="referenced project name" version="1.0.0" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
</package>
But I get this error again:
Unable to find package referenced project name. No packages exist with this id in source(s): Local Nuget, Microsoft Visual Studio Offline Packages, nuget.org
It seems that visual studio tries to find this dependency as a nuget package again. How can I solve this problem?