We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error loading DocIO assemblies in .NET Standard library targetted by WPF project

Hello,

I'm having issues getting the syncfusion DocIO/XlsIO packages to work.

I have a WPF project targetting .NET Framework v4.6.1. This project targets a couple of .NET Standard 2.0 class libraries which contain my Syncfusion logic. When using the following combination of packages:



I get the following error:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Syncfusion.DocIO.Portable, Version=17.1200.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' or one of its dependencies. The system cannot find the file specified.'

However, when I use the WPF packages, I get another error:



System.IO.FileNotFoundException: 'Could not load file or assembly 'Syncfusion.DocIO.Base, Version=17.1460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' or one of its dependencies. The system cannot find the file specified.'

What is the correct set of packages I should use in this scenario? Please note that only the Syncfusion.License package is referenced directly by the WPF project, the other ones are referenced by a .NET Standard 2.0 CL. 

Kind regards,

Floris Verhoeven

8 Replies

VA Vijayasurya Anandhan Syncfusion Team June 7, 2019 08:59 AM UTC

Hi Floris,

Thank you for contacting Syncfusion support.

We suspect that the installed NuGets are not referenced properly in your current project.
 
1.   Please make sure all the assemblies are referenced properly in the project. 
2.   Please install either WPF packages or NETStandard packages. Installing both will cause conflicts. 
3.   Please make sure all the packages are in the same version. 
 
Please find the assemblies required for your application based on the platform from the below UG documentation page: 
 
Please find the NuGet required for your application based on the platform from the below UG documentation page: 
https://help.syncfusion.com/file-formats/docio/nuget-packages-required

Since you are using .NET Standard library, we suggest you use the Portable assemblies (Syncfusion.DocIO.Portable) in your project.



Regards,
Vijayasurya A
 



FV Floris Verhoeven June 7, 2019 12:23 PM UTC

Hello, 

Below are the contents of my .csproj file of the .NET Standard class library.

Here I'm getting the following error:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Syncfusion.DocIO.Portable, Version=17.1200.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' or one of its dependencies. The system cannot find the file specified.'


<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Autofac" Version="4.9.2" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
    <PackageReference Include="Syncfusion.DocIO.Net.Core" Version="17.1.0.50" />
    <PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="17.1.0.50" />
    <PackageReference Include="Syncfusion.Pdf.Net.Core" Version="17.1.0.50" />
    <PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="17.1.0.50" />
    <PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="17.1.0.50" />
    <PackageReference Include="System.Data.SqlClient" Version="4.6.0" />
  </ItemGroup>
</Project>



VA Vijayasurya Anandhan Syncfusion Team June 10, 2019 12:02 PM UTC

Hi Floris,

As mentioned earlier, we suspect that the assemblies are not referenced properly in your project.  
Please check whether the installed NuGet are properly restored in the “.nuget” folder and the required assemblies are available in the below location in your machine.

Location:
C:\Users\labuser\.nuget\packages\Syncfusion.DocIO.Net.Core\17.1.0.50\lib\netstandard2.0\Assembly

Example: C:\Users\labuser\.nuget\packages\Syncfusion.DocIO.Net.Core\17.1.0.50\lib\netstandard2.0\Syncfusion.DocIO.Portable.dll

If it is not restored or the assemblies are not available in that location, we suggest you do the below steps: 
1.     Uninstall all the NuGet from the project. 
2.     Clean your project 
3.     Install the necessary NuGet from nuget.org 
4.     Build and run the solution. 

Please let us know if you have any queries.

Regards,
Vijayasurya A

 



FV Floris Verhoeven June 10, 2019 12:30 PM UTC

Hello,

I've checked the folder and the expected files are there. 
Under 'C:\Users\flori\.nuget\packages\syncfusion.docio.net.core\17.1.0.50\lib\netstandard2.0' I'm seeing both the Syncfusion.DocIO.Portable dll and xml file. 

I've tried cleaning the local packages folder, cleaning and rebuilding the solution. Still getting the same error.

Kr,

Floris


FV Floris Verhoeven June 10, 2019 12:53 PM UTC

I've added a minimal example which has the same issue. Please find it attached.

Kr,

Floris

Attachment: SyncfusionTest_1f8ac966.zip


VA Vijayasurya Anandhan Syncfusion Team June 11, 2019 11:00 AM UTC

Hi Floris,

Thank you for your update.

On further analyzing the given sample, we have found that you have been trying to do the following:
 
1.   Created a class library (with ASP.NET Core code examples) “SyncfusionTest.Logic” in WPF application, which contains all the logical parts of your application. 
2.   Created a WPF application (“SyncfusionTest.WPF”), where you referred the compiled assembly of “SyncfusionTest.Logic” class library. 
3.   The logical parts (ASP.NET Core) are triggered from the WPF application (by calling method “”) 
Since WPF and .Net Standard are different platforms, you have to add all the dependency of the class library into the WPF application. Because, we are initiating the process from WPF application and so, it will search the dependency packages in the below location. 
SyncfusionTest\SyncfusionTest.WPF\bin\Debug 
But we have not added the dependency packages into the corresponding WPF application so the issue occurs. To avoid this issue, either we need to manually refer all the dependency packages used in the class library into the WPF application or we need to manually place all the dependency into the below path.  
SyncfusionTest\SyncfusionTest.WPF\bin\Debug 
 
We have modified the sample as per the above (moved dependent assemblies) and it can be downloaded it from the below link:
http://www.syncfusion.com/downloads/support/forum/145107/ze/SyncfusionTest-2124698872.zip

Please let us know if you have any queries.
 
Regards,
Vijayasurya A



FV Floris Verhoeven June 11, 2019 11:39 AM UTC

Hello,

Thanks for your assistance!

Manually copying the packages is no real solution for us though. We are using GIT and the bin folder is not persisted/copied.

Is this an issue that will be fixed in the future? Or is it a platform limitation? With the future release of .NET Core 3.0, and with it WPF support, we would prefer to keep all this logic in .NET Standard class libraries.

Kind regards,

Floris


VA Vijayasurya Anandhan Syncfusion Team June 12, 2019 10:12 AM UTC

Hi Floris,


Thank you for your update.


As mentioned earlier, WPF and .NET Standard are different platforms. To achieve your requirement, you need to do any of your suggestion which we have mentioned in our previous update.


This is not the issue in Syncfusion Essential DocIO product, this is the behavior in Visual Studio. If you need further assistance regards this query, we request you to contact Visual Studio support or forum.


Please let us know if you have any queries.


Regards,
Vijayasurya A




Loader.
Up arrow icon