Add externals dlls to Maui project through common class library

דני שטרית 1,716 Reputation points
2023-04-27T10:36:08.9433333+00:00

Hi,

I have 4 projects:

1.Client maui.

2.Shared class library.

3.Worker service.

4.Test project

All projects have project reference to Shared project.

I have created folder in Shared project.

and imported all files as reference see sniped code:


<Reference Include="ComponentPro.Ftp">
      <HintPath>ComponentPro_Net2_0\ComponentPro.Ftp.dll</HintPath>
      <Private>True</Private>
    </Reference>
<R

Why the test project do reported on missing assembly while MAUI and worker service do not complian?

Is it the right way to share the dlls?

I also imported the files from test project to solve the problem is the way ?

 <Reference Include="ComponentPro.Ftp">
      <HintPath>..\AutomationClient.Shared\ComponentPro_Net2_0\ComponentPro.Ftp.dll</HintPath>
      <Private>True</Private>
    </Reference>
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
308 questions
{count} votes

1 answer

Sort by: Most helpful
  1. דני שטרית 1,716 Reputation points
    2023-05-02T08:30:02.29+00:00

    First is working.

    Second I have not used NuGet packages in this case in share project.

    I have client A has project reference to Shared

    <ItemGroup>
    
    	  <ProjectReference Include="..\AutomationClient.Shared\AutomationClient.Shared.csproj" />
    
    	</ItemGroup
    

    and Shared folder has project reference to AutomationClient.API

    <ItemGroup>
        <ProjectReference Include="..\AutomationClient.API\AutomationClient.API.csproj" />
      </ItemGroup>
    

    and service worker has two reference types AutomationClient.API & Shared

    <ItemGroup>
    		<ProjectReference Include="..\AutomationClient.API\AutomationClient.API.csproj" />
    		<ProjectReference Include="..\AutomationClient.Shared\AutomationClient.Shared.csproj" />
    	</ItemGroup>
    

    If i put the dlls in client A or service worker the dlls will be duplicated.

    Any solution ?