0

I am trying to use 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>

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, .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 new solution where I want to consume package from local feed. I copied the same nuget.config file to folder where 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 nuget add command, new version is present in x:\nuget...., but I am unable to browse local feed any more in MNPfS screen. As soon as I open MNPfS, I get following message in window where packages should be listed:

Error occured

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 local feed repository, then I can browse again in MNPfS and new package is displayed, and can be installed. So, the problem occurs only when two versions of same package are present.

Anyone knows why is this happening, and how can I have multiple versions of same package in local feed?

Goran
  • 6,328
  • 6
  • 41
  • 86

1 Answers1

0

Looks like the problem was related to nuget add command -Source parameter. When source points to partition with FUSE file system, then it does not create proper nuspec file, although no error is provided in Package Manager console.

nuspec file results in content with multiple NULL values. If I specify -Source to current partition where project is, then nuspec file is properly created, and then I can just copy the content to FUSE file system, and all works OK.

Goran
  • 6,328
  • 6
  • 41
  • 86