Version conflict with a dll - dll

I am developing an mvc application that uses Umbraco and NopCommerce.
Umbraco depends on dll called AutoMapper.dll with version 3.0.0.0.
NopCommerce depends on the same dll but with version 3.3.1.0.
So when I add the dll with version 3.0.0.0 then NopCommerce crashes.
When I add the dll with version 3.3.1.0 then Umbraco crashes.
So i somehow need to use the same dll with two different versions.
I have tried to add something like below to the web.config file:
<dependentAssembly>
<assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral"/>
<codeBase version="3.0.0.0" href="F:\Visual Studio test projects\UmbracoTest\UmbracoTest\bin\AutoMapper3000\AutoMapper.dll"/>
<codeBase version="3.3.1.0" href="F:\Visual Studio test projects\UmbracoTest\UmbracoTest\bin\AutoMapper3310\AutoMapper3310\AutoMapper.dll"/>
</dependentAssembly>
But with no luck.
Have anyone been in the same situation? Any advice on how to solve this?
Thanks! :)

No such luck, Umbraco simply doesn't support Automapper versions > 3.0. See this recent tweet conversation. How tied to NopCommerce are you? There are other options specifically for Umbraco, like Merchello or uCommerce.

Related

ASP.NET Core referencing TPL NuGet package Cannot Find File or Assembly System.Threading

I am making a new ASP.NET Core 2.0 project, essentially a Web API. I have to reference several assemblies that are .NET 3.5 assemblies, so I am running this as a .NET Framework project, just using the .NET Core improvements where possible.
The referenced .NET framework 3.5 assembly references TaskParallelLibrary (1.0.2856). And I think that's where my issues are coming in. It's worth noting the Web API worked on its sample endpoints and all worked as expected.
When I run the application and try and use the referenced library, the call fails and I receive the following exception:
Could not load file or assembly 'System.Threading, Version=1.0.2856.102, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'
or one of its dependencies. The system cannot find the file specified.
I have tried several things, including:
Adding an App.configx file to try and force it to target .NET framework 4's System.Threading, on the assumption that that will be available. Inspired by a page I can't find the link for:
Here's the content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- this is only here for binding redirects -->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Directly adding the TaskTPLLibrary package at that version to the project. So far, it hasn't helped.
Adding the Microsoft.Bcl.Async library to my project. Again, nothing.
Trying to directly import System.Threading from "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\System.Threading.dll". I get an error stating "The reference is invalid or unsupported."
I've tried several other things, including re-cloning, cleaning, re-cleaning, swearing vociferously and coming back at it another day, all to no avail.
My reading list includes (on this computer):
https://github.com/dotnet/corefx/issues/26084
Could not load file or assembly System.Threading.Tasks, Version=2.5.19.0
ASP.NET Core 2.0 Site - FileIOException System.Runtime
And probably others that I can't remember
Some additional information as this issue continues:
Creating a .NET Framework ASP.NET MVC app using .NET Framework 4.6.2 with the same underlying library does work. It does it indirectly using an intermediary .NET Framework 3.5 one (just for convenience as much as anything else).
A .NET Framework 4.6.2 Console App that uses the library directly also runs into this problem. So it seems not to be ASP.NET Core itself. I'll change the tags accordingly.
Making the 4.6.2 console use the intermediary 3.5 library doesn't resolve the issue.
Any help in resolving this issue much appreciated.
As there's no reasonable answer forthcoming, I'm assuming that having a .NET 3.5 Framework library referenced that uses the TaskParallelLibrary will in essence mean that using any .NET above 4 will cause this error. Under unspecified conditions. Most of the time.
The only solution to this seems to be rewrite everything to multi-target .NET 3.5 and .NET Standard and have the Standard implementation use the real TPL and have the 3.5 one use the NuGet package.

There was an error running the selected code generator: Could not load file or assembly Microsoft.EntityFrameworkCore, version = 2.0.1.0

When I was creating a Controller and a View by MVC Controller with views, using Entity Framework I got an error.
The Error is:
There was an error running the selected code generator: 'Could not
load file or assembly Microsoft.EntityFrameworkCore, version =
2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' the located assembly's manifest definition does not match the assembly reference
Creating MVC Controller with views, using Entity Framework:
How can I solve this problem?
I use Visual Studio Version 15.5.2 and version of Microsoft.AspNetCore.All is 2.0.0
I updated the Microsoft.AspNetCore.All to version 2.0.3 and now it does work right.
Go to NugetPackage Manager and update the Microsoft.AspNetCore.All package
For me none of the above solutions worked. I had to add Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Design packages even though I have Microsoft.AspNetCore.All package added to my project.
Edit project in VS 2017 and add these lines
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.3" />
Update your packages or it can happen when you have an older SDK. Download a new .NET Core SDK and runtime from www.microsoft.com/net
I had a similar issue but mine was something with the versioning of visual studio.
I went to Visual Studio Installer and it notified me that I had to restart my computer
I got this same error:
Running Preview 2019 and .NET Core 3.
I moved the Nuget pkg sources up in my list.
I was attemping to add a new Controller and I would get this error every time.
I also noticed that for some reason I chose not to set up SSL but I had the setting in my launchSettings.json.
I deleted the setting for ssl and built the app and ran it.
After the successful run I could add the Controller without the error.
Follow these Steps:-
From Tools
Select NuGet Package Manager
-> Manage NuGet Packages For Solution
click on ->Updates Select the checkbox Select All
->Select Your Project from right hand side -> Click on Upadate
Having the same error, after downloaded VS2019"PREVIEW" and then opened a core 3.0 project there I was able to scaffold content no errors at all..

System.IO.FileNotFoundException with Pivotal.Gemfire.dll

I am installing a C# windows service that uses Geode onto a UAT Windows 2012 server. The referenced dll (like log4net, newtonsoft.json and QuickFix) are working except for Pivotal.Gemfire.dll
When I start the service I get System.IO.FileNotFoundException: Could not load file or assembly 'Pivotal.Gemfire.dll' or one of its dependencies. The specified module could not be found. File name: 'Pivotal.Gemfire.dll'
Now Gacutil doesn't come with Win Server 2012. I've tried installing Windows SDK and .Net SDK and not found a Gacutil executable. So I've tried to get in the dll into the GAC using powershell like this:
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("D:\Pivotal.Gemfire.dll")
I've tried regsvr32 Pivotal.Gemfire.dll in various flavours
I've tried compiling and running the GacInstall executable at https://github.com/apache/geode-native/tree/develop/executables/GacInstall. It says Installation completed successfully. but when I try to run the service, or try powershell:
([system.reflection.assembly]::loadfile("D:\Pivotal.Gemfire.dll")).FullName
I get the same error.
I've tried a private assembly using runtime assembly binding
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Apache.Geode" publicKeyToken="null" culture="neutral" />
<codeBase version="9.1.1-build.2" href="file://Pivotal.Gemfire.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
and various flavours of name Pivotal.Gemfire, Apache.Geode.Client according to Implementing Shared Assembly but always the same error.
Any ideas? Thanks...
UPDATE: Make sure you have x86 and x64 bit C++ packages back to 2013 (for older versions of Geode Net client)
I downloaded the previous version of Geode, 9.0.7, called Gemstone.Gemfire.Cache.dll and got the same error, but that version included a Gemstone.Gemfire.Cache.xml in the same directory. If I took the xml file to my bin directory the error stopped and the service started properly.
So like this the problem is a redundant accompanying xml file to the dll. I fixed the issue by creating a new dummy xml file Pivotal.Gemfire.xml
<?xml version="1.0"?>
<doc>
</doc>
For me the marked answer did not work.
I had to download DependencyWalker which showed me why the Pivotal.Gemfire.dll was not working. One of missing DLLs was from:
Visual C++ Redistributable Packages for Visual Studio 2013
After installing 64x bit, application started to work.
This problem happened again with another install. The answer above using the xml file did not resolve it, it was resolved by downloading version 9.0.7 of the Native Client, Gemstone.Gemfire.Cache.dll and then running
.\gacutil /if C:\Gemstone.Gemfire.Cache.dll
which returned Assembly successfully added to the cache then removing the earlier version of the dll, but retaining the later version Pivotal.Gemfire.dll that I could not get into the GAC because of a strong name issue. This bizarre workaround of getting the earlier version of the dll into the GAC allows the GAC to find - and use - the later version...
This happened to me again with a Geode Native built locally, when it is run on a new Windows 10 install the dependency walker shows missing MSVCP140D.DLL VCRUNTIME140D.DLL and UCRTBASED.DLL as here
The D is related to having built the client in debug mode.
The problem is related to How can I install a Visual Studio C++ redistributable if it is missing? and the answer is either to get a release build of your dll, or to go to Visual Studio Installer, Modify, navigate to Individual components -> compilers, build tools, and runtimes, and check the MSVC v 140 VS 2015 C++ build tools
Yet another time this happened to me and I had to remove references and files to Apache Geode dll built as native client, then reference them all again.

which version of fluent nhibernate is compatible with nhibernate 3.2

i see when i install fluent nhibernate 1.2 from Nuget, it downloads nhibernate 3.1. If i want to use nhibernate 3.2, how would i do that through nuget and it is compatible with fluent nhibernate 1.2 ?
If you use the Nuget Package Manager Console instead of the GUI to get the package (Install-Package FluentNHibernate) you will get version 1.3.0.717 which is compatible with NHibernate 3.2
I tried it and is working fine for me.
Here you can read about plans to release FluentNHibernate for 3.2GA soon and a suggested workaround using attributes
http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/8e782e45ed9ba647
I got my working using
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NHibernate"
publicKeyToken="aa95f207798dfdb4"
culture="neutral" />
<bindingRedirect oldVersion="3.1.0.4000"
newVersion="3.2.0.4000"/>
</dependentAssembly>
</assemblyBinding>
Currently, the FluentNHibernate package from the offical NuGet package source, depends on NHibernate.Castle 3.1 (currently, there is no newer version yet), which in turn depends on NHibernate 3.1 (the exact version, not 3.1 or higher). Therefore, NuGet infers a dependency on NHibernate 3.1 when installing FluentNHibernate.
So the bottom line is: you can't, until the FluentNHibernate package is updated.
The most practical way around is getting the latest FluentNHibernate source code and building it against NHibernate 3.2. I've tested that and it seems to work just fine. You might even be fine using assembly binding redirects, but I haven't tested that.
Alternatively, you can wait for NHibernate 3.2 to reach GA (final) and FluentNHibernate to catch up, but of course that's not a very satisfying answer.

Install NHibernate 3.2 with NuGet

I'm new to NHibernate and have been trying to get up and running with it, Fluent NHibernate and NHProf using NuGet. After reading this article (http://gurustop.net/blog/2011/03/13/nhibernate-3-1-0-on-nuget-important-details) it seems that v3.1 shouldn't be directly installed, however, there appears no such warning for v3.2.
After successfully installing NHibernate 3.2 and NHProf using NuGet, I'm unable to install Fluent NHibernate as it says it's "Already referencing a newer version of NHibernate".
Also, when I run my app I get the following error "Could not load file or assembly 'NHibernate.ByteCode.Castle' or one of its dependencies". The following link (Could not load file or assembly in NHibernate) suggests installing a number of additional assemblies, which is what I was hoping to avoid by using NuGet in the first place.
At this point would it just be easier to follow the steps on NHForge to get things up and running as the packages on NuGet don't appear to be compatible?
NHibernate 3.2 comes with its own proxy factory. If you're using a config file, you just need to remove the proxyfactory configuration property.
I believe the version of Fluent NHibernate that you're using defaults to use NHibernate.ByteCode.Castle. In that case, you would need to override that setting with the built in NHibernate 3.2 proxy factory:
.ProxyFactoryFactory("NHibernate.Bytecode.DefaultProxyFactoryFactory, NHibernate")
Each version of Fluent NHibernate uses an exact version of NHibernate (included in the Fluent NHibernate package)
You should remove the NHibernate package and add only Fluent NHibernate
If you use the Nuget Package Manager Console instead of the GUI to get the package (Install-Package FluentNHibernate) you will get version 1.3.0.717 which is compatible with NHibernate 3.2
I tried and is working fine for me. I answered this already on this link: which version of fluent nhibernate is compatible with nhibernate 3.2
I'm using this consctruction in config file to make FluentNhibernate work with NHibernate 3.2
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.0.1001" newVersion="3.2.0.1001" />
</dependentAssembly>
</assemblyBinding>
</runtime>
NHibernate 3.2 comes with its own mapping configuration (Conform). FluentNHibernate only works with NHibernate 3.1 as a result of this, you can't use 3.2 (I had the same problem). So you'll have to manually download 3.1 and reference that unless NuGet allows you to use 3.1 directly.
Your other option is to remove all references to 3.2 and then install FluentNHibernate from NuGet, then the dependency resolver will kick in and automatically include NHibernate 3.1 for you.