Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.40/5 (3 votes)
See more: , +
All under .NET 7.0

Given is a custom library isential.crypt.dll that contains no external dependencies. A NuGet package was created from it and stored in a local package source.

A second custom library named isential.MySqloverSsh.dll uses three NuGet packages:

* isential.crypt
* MySql.Data
* SSH.NET

From this, I create another NuGet package called isential.MySqloverSsh and also store it in the same local package source.

The isential.MySqloverSsh.csproj looks like this:

XML
<Project Sdk="Microsoft.NET.Sdk">
 <PropertyGroup>
   <TargetFramework>net7.0-windows8.0</TargetFramework>
   <ImplicitUsings>enable</ImplicitUsings>
   <Nullable>enable</Nullable>
   
   <!-- NuGet-Paket-Metadaten -->
   <PackageId>isential.MySqloverSsh</PackageId>
   <Authors>isential gmbh</Authors>
   <Description>Stellt eine MySql-Verbindung über einen SSH-Tunnel her und öffnet diese gleichzeitig.</Description>
   <PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
   <PackageProjectUrl>https://isential.de</PackageProjectUrl>
   <RepositoryUrl>https://isential.de</RepositoryUrl>
   <RepositoryType>Privat</RepositoryType>
   <PackageTags>isential MySqloverSsh</PackageTags>
   <AssemblyName>isential.MySqloverSsh</AssemblyName>
   <RootNamespace>isential.MySqloverSsh</RootNamespace>
   <Title>isential.MySqloverSsh</Title>
   <Version>1.0.0</Version>
   <Company>isential gmbh</Company>
   <Product>isential.MySqloverSsh</Product>
   <Copyright>(C) isential gmbh - alle Rechte vorbehalten.</Copyright>
 </PropertyGroup>
 
 <ItemGroup>
   <PackageReference Include="isential.crypt" Version="1.0.0" />
   <PackageReference Include="MySql.Data" Version="8.1.0" />
   <PackageReference Include="SSH.NET" Version="2020.0.2" />
 </ItemGroup>
</Project>


The NuGet package is created without errors.

I include this NuGet package in the target project. This is a WPF project under .NET 7.0.

The NuGet package manager also shows me everything correctly:

Abhängigkeiten
    net7.0
        MySql.Data (>=8.1.0)
        SSH.NET (>= 2020.0.2)
        isential.crypt (>= 1.0.0)


As you can see, isential.crypt is also listed as a dependency. However, after including it in the solution under "Packages", I have the following picture:

Pakete
    isential MySqloverSsh (1.0.0)
        Kompilietzeitassemblys
        Inhaltsdateien
        Dokumente
        MySql Data (8 1 0)
        SSH NET (2020.0.2)


As you can see, isential.crypt (1.0.0) is missing.

I have tried to include the library isential.crypt.dll directly in isential.MySqloverSsh as a DLL or project reference and still it is not available in the target project. Sure I can include isential.crypt.dll in the target project manually, but I'd rather do it via isential.MySqloverSsh to not have to worry about dependencies - this is supposed to be done automatically via the package isential.MySqloverSsh.

Why does this happen and how can I solve this?

What I have tried:

I tried to include isential.crypt.dll directly as a DLL (as a project reference) in isential.MySqloverSsh. But even in this case, the DLL is missing in the target project when including isential.MySqloverSsh.
Posted
Updated 17-Aug-23 8:24am
v2
Comments
Richard Deeming 16-Aug-23 4:27am    
Check the Visual Studio output window for errors. Perhaps the missing reference isn't compatible with the project's target framework?
temuco 16-Aug-23 4:52am    
Both DLLs (isential.crypt and isential.MySqloverSsh) and the WPF application have .NET 7 as target framework. All of them have Windows as target operating system and "AnyCPU" as CPU.

1 solution

I noticed that there is a difference between the version of a NuGet package and the version of the assembly it contains. Previously, I had set the assembly version to "1.0.*", which meant that it was automatically incremented with each build. This caused some confusion.

To fix the problem, I manually set the assembly version and file version to "1.0.0" to match the version of my NuGet package. That solved the problem and now my library isential.crypt shows up correctly in my projects.

In the process, I learned that keeping the versions of NuGet packages and assemblies in sync is helpful in cases like this, especially when creating your own library. It makes things easier and avoids confusion.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900