PackageReference and Client Profile

We use Aspose.Words 14.4.0 (old I know) through nuget.

We have just upgraded our projects to use PackageReference. The issue is that when referenced through the new PackageReference system, it is pulling through the Client Profile dll, rather than the full dll. There doesn’t seem to be a way to specify which version you want it to use in PackageReference system.

This means that we are hitting the following issue as described here https://docs.aspose.com/words/net/save-a-document/

This overload of the Save method is not available when using the .NET Client Profile DLL. This DLL is located in the net3.5_ClientProfile folder. The .NET Client Profile excludes assemblies such as System.Web therefore HttpResponse is not available. This is entirely by design.

This can manifest itself as an error:

"No overload for method 'Save' takes '4' parameters."

If you need to use Aspose.Words in ASP.NET application, It is recommended to use the .NET 2.0 DLL where the correct overload described in this article is available.

How can we force nuget to pull the non-client profile version of the dll?

@isams,

For .NET, we ship four types of DLLs of Aspose.Words API which are present in “net2.0”, “net3.5-client”, “net40” and “net40-client” sub-folders under the “lib” folder when we package Aspose.Words to NuGet repository.

When you install Aspose.Words for .NET via NuGet package, NuGet will automatically reference the correct version of DLL according to the Target .NET Framework version of your project and you do not have to manually choose the DLL version.

In case when the Target .NET Framework of your application is “.NET Framework 3.5 Client Profile”, the ‘net3.5-client’ version of Aspose.Words assembly will automatically be referenced. The “net20” and “net40” versions of Aspose.Words DLL, which contain the desired Document.Save overload i.e. (HttpResponse, String, ContentDisposition, SaveOptions), will only be referenced when the “Target .NET Framework” of your application is 2.0, 3.0, 3.5, 4.0 or higher. Hope, this helps.

Hi @awais.hafeez,

I’m afraid this is not the case. Remember, we are using Aspose.Words 14.4.0

The nuget package contains two target frameworks:

  1. net2.0
  2. net3.5-client

Our project targets .Net 4.6 (not client profile). In this scenario, nuget will pull in the net3.5-client dll (the wrong one) and there isn’t a way to override it without referencing the net2.0 dll manually and skipping nuget. This is what I’m trying to avoid.

@isams,

Please note that we do not provide support for older versions of Aspose.Words and we do not provide any fixes or patches for old versions of Aspose APIs either. We always encourage our customers to use the latest versions of Aspose.Words (to date it is 19.1) as latest versions contain newly introduced features, enhancements and fixes for issues reported earlier. So, we suggest you please try installing the latest version of Aspose.Words for .NET via NuGet. Hope, this helps. Thanks for your understanding.

@awais.hafeez

I understand what you’re saying, but you do keep the old packages on nuget and they are currently broken. If you don’t support them, then why keep the packages around. Given you keep them around, I think you should fix the packaging. I am not asking for a bug fix or a recompile or anything.

It is impossible to create a project targeting .net 4.0+ and to get nuget to reference the non-client version of the dll.

@isams,

We are checking this scenario and will get back to you soon.

@isams,

Upon further investigation we have found that unfortunately, there is no way to change old NuGet packages. It seem this package was working fine few years ago, but now the NuGet DLL selecting mechanism has been changed. So, the only way to make it work is to use the latest package. We apologize for any inconvenience.