如何在UNIX上正确打包,推送和还原NuGet程序包,以便auth和symbol下载能够正常工作?

时间:2019-01-16 17:11:09

标签: c# .net-core nuget

简介

我正在设置dotnet工具和自定义NuGet软件包服务器之间的交互,并且需要所有可能的

来源

Makefile(用于测试)如下:

name:=DemoLib
version:=0.1.0
server:=http://localhost:9902/v3/index.json
key:=F143tEizkkeHQr7/cvwCjQ==

clear-cache:
    dotnet nuget locals http-cache --clear

pack:
    dotnet pack $(name) --output . --include-symbols --include-source -p:PackageVersion=$(version) -p:SymbolPackageFormat=snupkg

publish: clear-cache
    dotnet nuget push $(name)/$(name).$(version).nupkg --source $(server) --api-key $(key)

unpublish: clear-cache
    dotnet nuget delete $(name) $(version) --source $(server) --api-key $(key) --non-interactive

install: clear-cache
    rm -rf ~/.nuget/packages/demolib*
    dotnet restore App --verbosity d
    dotnet build App
    dotnet run -p App

nuget.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <clear />
        <add key="annium" value="http://localhost:9902/v3/index.json" />
        <add key="nuget" value="https://api.nuget.org/v3/index.json" />
    </packageSources>
</configuration>

DemoLib.csproj:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netcoreapp2.2</TargetFramework>
        <DebugType>Portable</DebugType>
        <OutputType>Library</OutputType>
    </PropertyGroup>
</Project>

App.csproj:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netcoreapp2.2</TargetFramework>
        <DebugType>Portable</DebugType>
        <OutputType>Exe</OutputType>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="DemoLib" Version="0.1.0" />
    </ItemGroup>
</Project>

问题

  1. 要在打包和还原过程中进行哪些更改,以便下载符号? (使用VS Code进行开发)
  2. 如何修改命令/ nuget.config以使NuGet发送X-NuGet-ApiKey标头来注册,版本和下载的URL?

P.S

  1. 还没有尝试<DebugType>Embedded</DebugType>。这是正确的方法吗?
  2. 尝试同时使用ClearTextPasswordnuget setapikey。但是没有效果。

0 个答案:

没有答案