Free Support Forum - aspose.com

No Aspose.Email for .Net 4 starting from 17.12

Hi,

I have .Net 4.7 application that uses Aspose.Email to process EML files.

Recently I tried to update Aspose.Email to 17.12. What I noticed is that new dependency was introduced: System.Text.Encoding.CodePages.

dependency.png (1.5 KB)

Later I noticed that this update resulted into the unexpected result - target folder contained 20+ more libraries after rebuilding project (for example, System.AppContext.dll, System.Collections.dll, System.Collections.Concurrent.dll etc.)

result.png (11.9 KB)

It happens because the new dependency (System.Text.Encoding.CodePages) is a part of .NetStandard,Version=v2.0 (see dependency.png).

  1. Can I have Aspose.Email after 17.11
    – w/o this dependency at all?
    – or with CodePages dependency but for .NetFramework 4.5 or higher (not .NetStandard)? I checked NuGet packages and there is version of System.Text.Encoding.CodePages for .NetFramework,Version=4.6.
  2. Why there is no Aspose.Email after 17.11 with CodePages .NetFramework,Version=4.6 in NuGet packages?

Thanks.

@licenses,

This is how nuget works. .NET 4.6.2 and .NET 4.7 implements .NET Standard 2.0. And to properly work with Encoding, Aspose.Email has to load System.Text.Encoding.CodePages.dll which is the only dependency.

In turn System.Text.Encoding.CodePages.dll has its own dependencies. These may be different on different platforms, but are out of our control.

Also, if we create just a simple .NET 4.7 Console application, you will see that it contain 98 assemblies which shows that these are included as per dependencies.

Understand this.

But is there a way to prevent copying of half a framework to the output folder when project is built?

Thanks.

Unfortunately not, this is a known issue with .NET Framework 4.7 and 4.7.1

The issue is solved in .NET Framework 4.7.2 and you can try it by following the instructions here.

Thanks.

Just in case if anyone experiences the same issue I have found the following workaround:

  • Add the following text to csproj file

<PropertyGroup> <ImplicitlyExpandNETStandardFacades>false</ImplicitlyExpandNETStandardFacades> </PropertyGroup>

If your not new to the build process in VS, you may read C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.NETFramework.targets to get more details.

  • After the previous step you may get compilation error depending on whether you have reference to .NetStandard library (System.Text.Encoding.CodePages). Add reference to c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\netstandard.dll to your project.

If you do not have compilation error, then anyway do not forget to copy netstandard.dll to the target directory. Otherwise, you may get run-time error when Aspose.Email tries to use API from System.Text.Encoding.CodePages.

@licenses,

Many thanks for sharing your knowledge about this with us which will, ofcourse, be of help to others as well.