RestApiSDK references outdated PayPalCoreSDK dll - c#

Solution below
I'm trying to implement PayPal payment in an ASP.NET website, but when I run it on Azure, it tells me the assembly being referred to by RestApiSDK 0.1.1.0 is wrong. Local it all works.
Could not load file or assembly 'PayPalCoreSDK, Version=1.5.2.0, Culture=neutral, PublicKeyToken=5b4afc1ccaef40fb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I checked with .NET Reflector and the assembly being referred to is indeed 1.5.2.0, though the latest version in NuGet Packages is 1.6.0.0. I also uninstalled both packages and re-installed them, but no luck.
So, I have two questions:
Why does this work on my localhost?
How do I fix this to work on Azure Websites as well?
Edit: As #JasonZ suggested, I installed a new version of the PayPal SDK for .NET and that worked. Thanks!

My first thought would be 32 bit local machine vs 64 bit azure?
If that's not the case, I would try manually adding them to the GAC via a webjob as stated here:
http://blogs.infosupport.com/adding-assemblies-to-the-gac-in-windows-azure/
When you "uninstall and Reinstall" do you see them in the GAC on your azure vm?
=Devon

Answer by #JasonZ: The PayPal .NET SDK has since replaced the RestApiSDK library and removes the dependency on PayPalCoreSDK.

Upgrade the nuget package
PM> install-package PayPalCoreSDK -version 1.7.0
(To upgrade the package using visual studio [Top Menu] -> Tools -> NuGet Package Manager -> Package Manager Console)
Please follow the following link for more information. https://www.nuget.org/packages/PayPalCoreSDK/

Related

A ClickOnce installation failing because Microsoft.VisualStudio.Data.Core has to be installed in the GAC

I'm assisting a colleague who's working on a new WPF app. He's using .NET Framework 4.5.2. We generate a ClickOnce deployment for users to run. I can install the app using the ClickOnce installer, but users can't. They're getting this error:
I looked up Microsoft.VisualStudio.Data.Core on NuGet. I did that because when I brought up package manager I couldn't find it. So, I looked for everything that starts with "Microsoft.VisualStudio". This is what I found:
I can't find a Microsoft.VisualStudio.Data.Core.dll in the project. So, I figure Microsoft.VisualStudio.Data.Core must be in one of those other assemblies. Of course, it might not be in any assembly that starts with "Microsoft.VisualStudio". But clearly, since the ClickOnce deployment is trying to install it in the GAC, it's in the solution somewhere. Is Microsoft.VisualStudio.Data.Core a part of some other package? If so, what other package? Looking at NuGet, I've not been able to find out what might be using it.

C# nuget package dependency consolidation fails when running app as azure webjob

The exception when running as the console application as Azure webjob:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Azure.Core, Version=1.0.2.0, Culture=neutral, PublicKeyToken=92742159e12e44c8' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Locally this works and runs.
Referencing:
Azure.Identity version 1.3.0 which has a dependency to Azure.Core version >= 1.6.0
Azure.Security.KeyVaults.Secrets version 4.1.0 which has a dependency to Azure.Core version >= 1.0.2
So of course based on these nuspec specifications it should resolve to Azure.Core 1.6.0. Which it locally does and runs without a problem.
Yet when I deploy this using VS publish profile to our cloud as Azure Webjobs and run the application I get the exception mentioned above. (of course the file version deployed is the same as local, version 1.6.0)
I know I can fix this with an assemblybinding. Stating that version 0.0.0.0 to 1.6.0.0 should resolve to version 1.6.0.0.
But I find this very frustrating because it imposes manual labor and keeps us from updating packages whenever a newer version arrives because then we also have to remind ourselves to update the assemblybindings.
I feel like there is a better solution, or we are doing something wrong. But I simply do not know where to begin searching for a solution. I hope to get some insights from you guys!
PS:
This phenomenon is driving me nuts because we face similar issues when using packages:
Unity
Unity.Interception
Because they both depend on Unity.Container. Forcing us to either use assemblybinding to resolve this issue, or only use versions which depend on the same packages
Try doing the following steps because the approach you are taking is correct:
Uninstall both Azure.Identity and Azure.Security.KeyVaults.Secrets nuget packages.
Remove all the associated Assembly Bindings.
Delete bin and obj folders in your project folder.
Install Azure.Core version >= 1.6.0 and rebuild the solution.
Deploy the solution.
These should work ideally. I think that there are some stale dependencies which are getting deployed. You can also try deploying through pipelines, if not already doing.

Aspose.Cell error in .Net Standard 2.0 Library

Could not load file or assembly ‘Aspose.Cells, Version=19.7.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I am getting above in .Net Standard 2.0 type library. I have added Aspose.Cell nuget package reference to the library.
I think you need to add Aspose.Cells, Version=19.7.0.0 reference in hosting project also instead of only class library projects.
You may please add System.Drawing.Common library from the NuGet package manager to resolve the issue. In some cases you may also require System.Text.Encoding. Please note, while using NuGet package manager, it may automatically fetch all the required dependencies for Aspose.Cells, it look to me not in your case though. So, you should manually install System.Drawing.common v4.5.1 after installing Aspose.Cells 19.7.0.
To check the dependencies on Nuget repos page of Aspose.Cells v19.7.0, you may click on "Dependencies" node and may confirm the following depenencies for .NET Standard 2.0:
System.Drawing.Common (>= 4.5.1)
System.Text.Encoding.CodePages (>= 4.4.0)
Hope, this helps.
PS. I am working as Support developer/ Evangelist at Aspose.

Third-party applications asks for old assembly

Have a serious problem: need to install a third-party web application. After deploying to my local machine getting the exception:
Could not load file or assembly 'System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
The problem is i don't have sources, also nuget packadge manager cannot find anything similar to this version. Installation of Entity Framework ver. 4.2.0 does nothing either.
Any thoughts what and where I should download?
Best regards and thanks a log
You find nothing on nuget? HAve you ever tried?
Google.... "Entity Framework 4.2" leads me to...
https://www.nuget.org/packages/EntityFramework/4.2.0
That is nuget, that is Entity framework and that is 4.2.
Maybe, instead of nuget package manager, you use the nuget tools ;)
Download old version of package with nuget
tells you how to do that - using the command line (which accepts a version parameter).
You should try to install this manually:
Open the solution
Open the Package Manager Console
Type: Install-Package EntityFramework -Version 4.2.0
This will install the specific package version that you need.
You either need :
a. the assembly referenced
b. the source code to change the reference
I would contact whoever wrote the third-party application and try to resolve it from there.

Could not load file or assembly 'System.Net.Http' or one of its dependencies

Maybe Relevant information: I have a web application I built with .net 4.5. I wanted to deploy to Azure's Web Sites but it only supports .net 4.0 so I downgraded the project to .net 4.0.
It still works when run locally.
When I publish to Azure, i get this error:
Could not load file or assembly 'System.Net.Http' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have tried removing the Web API with nuget and readding it, as another question on SO suggested but I still have the same problem.
I have tried close/open VS, and clean/build.
I solved a similar problem (System.Web.Http and System.Net.Http.Formatting) error by removing the reference to problem reference (which was pointed to my .Net installation folder) and replacing it with the reference file in my packages folder that was installed by the Microsoft.AspNet.WebApi NuGet package.
I had the same problem. However, updating assembly versions, copy local, and specific version settings alone did not solve my problem. In my application configuration I deploy a web and a worker role to a cloud service. After creating the service, on the configure tab I set the Operating System to Windows Server 2012 R2 to get the support for .Net Framework 4.5.1. But the error still occured.
Upon further research, I found that the *.cscfg file for my cloud service overrode the portal setting with an obscure osFamily setting of "3". When I started my project it was on MVC3 and did not yet have WebAPI and framework 4.5.1. osFamily 3 was the latest at the time.
In my latest deployment I had upgraded my site to 4.5.1 framework and MVC5. I verified it worked locally on my development machine. But it didn't work after deployment with the error referencing System.Net.Http.Formatting version 4.0.0.0 not being found. I later saw the deployment log that showed the source error
"The feature named NetFx451 that is required by the uploaded package is not available in the OS * chosen for the deployment."
Here is the blog article that led me to the solution to change the osFamily setting to 4. Then my site worked after a fresh deployment.
http://tech.trailmax.info/2014/02/azure-deployment-the-feature-named-netfx451-that-is-required-by-the-uploaded-package-is-not-available-in-the-os-chosen-for-the-deployment/
System.NET.HTTP.dll only depends on System.dll, System.Core.dll and mscorlib.dll.
Make sure you have this DLL (System.NET.HTTP.dll) in your deployment package (you can do RDP connect and check deployment folder). Play with "Copy to Local" property of reference, or include this dll in your project on root level and set type "content" in properties.
Also System.Net.Http.dll is also supported for .NET 2.0 as i see - that might cause an issue. So additionally to above try to set property of reference "Specific version" = true
Azure Now supports .Net 4.5 on the configuration tab you can select .Net framework version V3.5 or V4.5 I have several MVC Web Apps with Numerous supporting DLLs all all compiled in V4.5. What Azure does not support is V 4.5.1 (from the VS 2013 RC release).
I had the same issue with an asp.net application with some Web Jobs which deployed to the same Azure App Service. It was solved by referencing the same System.Net.Http (nuget package) from all projects.
If all of the options you did didn't work, please try restarting (close / open as "admin") your visual studio, then clean / rebuild. This has fixed my problem.
Though this is only for my local machine, haven't tried yet with other environments like in azure or in any server.
I had the same experience with missing System.Net.Http issue.

Categories

Resources