在 .netcore3.1 中的库 outtype 中添加带有 nuget 的 dll 时无法构建 dll

Failure to build dll when adding a dll with nuget in the Library outtype in .netcore3.1

我有一个插件应用程序(.net web site link)。在解决方案中,有一个控制台应用程序和多个库类型的项目。正在加载选定的插件,应用程序开始监听。

问题是;如果我将nugetten dll添加到库类型的项目中,这些dll的编译版本应该在我指定的文件夹中有构建时创建。

.csproj;

 <Project Sdk="Microsoft.NET.Sdk">
          <PropertyGroup>
            <TargetFramework>netcoreapp3.1</TargetFramework>
            <OutputType>Library</OutputType>
            <SccProjectName>SAK</SccProjectName>
            <SccLocalPath>SAK</SccLocalPath>
            <SccAuxPath>SAK</SccAuxPath>
            <SccProvider>SAK</SccProvider>
            <AssemblyInfoFilePath>Properties\AssemblyInfo.cs</AssemblyInfoFilePath>
            <UpdateAssemblyVersion>True</UpdateAssemblyVersion>
            <UpdateAssemblyFileVersion>True</UpdateAssemblyFileVersion>
            <UpdateAssemblyInfoVersion>True</UpdateAssemblyInfoVersion>
            <AssemblyVersionSettings>None.None.Increment.DateStamp</AssemblyVersionSettings>
            <AssemblyFileVersionSettings>None.None.Increment.DateStamp</AssemblyFileVersionSettings>
            <AssemblyInfoVersionSettings>None.None.Increment.DateStamp</AssemblyInfoVersionSettings>
            <PrimaryVersionType>AssemblyVersionAttribute</PrimaryVersionType>
            <AssemblyVersion>2.0.0.0</AssemblyVersion>
            <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
            <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
            <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
          </PropertyGroup>
          <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        <OutputPath>..\Nemesis.Agent\bin\Debug\Plugins\PrinterPlugin\</OutputPath>
        <PlatformTarget>x86</PlatformTarget>
      </PropertyGroup>
          <ItemGroup>
            <PackageReference Include="itext7" Version="7.1.13" />
            <PackageReference Include="PdfiumViewer.Core" Version="1.0.4" />
            <PackageReference Include="PuppeteerSharp" Version="2.0.4" />
          </ItemGroup>
          <ItemGroup>
            ...
          </ItemGroup>
        </Project>

包;

文件夹

我在 PrintPdfDocument 中使用了这段代码;

var pdfDocument = PdfiumViewer.PdfDocument.Load(new MemoryStream(bytes));

运行时出错;

我找不到 error.I 的来源,我试过其他名称空间。如果我手动将编译的dll移动到相关文件夹,问题就解决了。 .net 框架没有这个问题。

我通过将以下代码添加到 csproj 中解决了这个问题。

<CopyLocalLockFileAssemblies>True<CopyLocalLockFileAssemblies>