繁体   English   中英

无法从自定义NuGet包导入类

[英]Can't import classes from custom NuGet package

我有一个带有1个接口和1个类的.NET标准库:

public interface ITestService
{
    void Test(string test);
}

public class TestService : ITestService
{
    public void Test(string test)
    {
        Console.WriteLine("Got this string: " + test);
    }
}

我使用nuspec文件使用Azure Pipelines(dotnet包和dotnet push)将库发布到Azure Artifacts中:

<?xml version="1.0"?>
<package>
  <metadata>
    <id>Service.Client</id>
    <version>5.0.2</version>
    <title>Service Client</title>
    <authors>auth</authors>
    <owners>owner</owners>
    <projectUrl>https://dev.azure.com/yyy/</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>My test nuget description</description>
    <releaseNotes>Test release</releaseNotes>
    <copyright>Copyright 2019</copyright>
    <tags>latest 5.0.2</tags>
  </metadata>
</package>

将这个库成功导入到我的其他项目中时,即使在nupkg中可以看到它们,我也无法通过VS2019看到ITestService / TestService!

有人可以帮我导入我的图书馆吗?

我正在使用nuspec和nuget pack命令,但似乎没有用。 我使用csproj字段和Azure Devops进行了切换,以使用dotnet pack命令,并且一切正常。

感谢zivkan的灵感:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM