uyusuk
uyusuk

Reputation: 361

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

I have a plugin application(.net web site link). In the solution, there is a console application and projects of more than one library type. The selected plugins are being loaded and the application starts a listening.

The problem is; If I add nugetten dll to a library type project, the compiled version of these dlls should be created when there is build in the folder I specified.

.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>

packages;

enter image description here

folder

enter image description here

I used this code In PrintPdfDocument;

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

error during runtime;

enter image description here

I could not find the source of the error.I've tried other namespaces. The problem is solved if I manually move the compiled dll to the relevant folder. .net framework wasn't having this problem.

Upvotes: 1

Views: 92

Answers (1)

uyusuk
uyusuk

Reputation: 361

I overcame this problem by adding the following code to csproj.

<CopyLocalLockFileAssemblies>True<CopyLocalLockFileAssemblies>

Upvotes: 1

Related Questions