I am trying to use a NuGet local feed for publishing my packages. So I tried to push my first component/package. I have the following nuget.config in my SDK project:
<?xml version="1.0" encoding="utf-8"?><configuration><packageSources><add key="nuget" value="https://api.nuget.org/v3/index.json" /><add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" /><add key="local feed" value="x:\nuget\packages\" /></packageSources><packageRestore><add key="enabled" value="True" /><add key="automatic" value="True" /></packageRestore><bindingRedirects><add key="skip" value="False" /></bindingRedirects><packageManagement><add key="format" value="0" /><add key="disabled" value="False" /></packageManagement></configuration>
The SDK Project's configuration is as follows:
<PropertyGroup><TargetFramework>net6.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings><Title>My custom component</Title><Version>0.0.1-alpha</Version><PackageId>$(RootNamespace)</PackageId></PropertyGroup>
I set the project to Release configuration, and execute Pack command. As a result, a .nupkg file is created in bin/Release folder.Inside the package manager console window, I execute the following command:
nuget add pathToNupkgFile -Source x:\nuget\packages
So far so good, package is located in folder x:\nuget\packages\companyname.components.blazor.mycomponent\0.0.1-alpha.
Now I created a new solution where I want to consume the package from my local feed. I copied the same nuget.config file to the folder where the new solution was created. I open Manage NuGet Packages for Solution (short MNPfS), search for new package, and install it. All fine until this point.
Now, if I do the same procedure and create 0.0.2-alpha nupkg, after the NuGet add command, a new version is present in x:\nuget...., but I am unable to browse the local feed any more in MNPfS screen. As soon as I open MNPfS, I get the following message in window where packages should be listed:
Error occurred
And error list window displays following message:
Error [local feed] '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1.
Now, if I delete version 0.0.1-alpha from the local feed repository, then I can browse again in MNPfS and the new package is displayed, and can be installed. So the problem occurs only when two versions of same package are present.
Why is this happening, and how can I have multiple versions of same package in the local feed?