Autofac.Extras.DynamicProxy2 With Autofac 3.5.2 - aop

I have 2 projects in my solution.
One uses Autofac 3.5.2 and the other is used Autofac.Extras.DynamicProxy2 for interception (Autofac 3.3.1).
The one with Autofac 3.3.1 has project reference to the one with Autofac 3.5.2.
Trying to run different dll versions in my solution fails, while upgrading 3.3.1 to 3.5.2 skips interceptor logic.
I would like to run interception on Autofac 3.5.2 since I use 3.5.2 on many other project I develop.
Did someone faced this issue with success?
Thank you
The error I get is:
Error 5 Assembly ' , Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' which has a higher version than referenced assembly 'Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da'

You have to use assemblyBinding:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Related

Using 2 versions of log4net in one application

I have a need to reference 2 different versions of log4net in my application.
An older assembly I am referencing uses log4net-net-1.0.dll version 1.2.0.30507,
whereas my newer dependencies use log4net V1.2.15.
I have tried placing this in the web.config to have my application look in a different folder when trying to find the older log4net dll:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net-net-1.0" publicKeyToken="b4df9eabc7e0e71e" />
<codeBase version="1.2.0.30507" href="log4netv1.2.0\log4net-net-1.0.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
But the dll is not getting found.
Is there something else I need to do in order for this to work.

MVC 4 Can't fix the error The type 'System.Web.Mvc.WebViewPage <TModel> exists in the elements

after moved my MVC 4 project from VS 2012 to VS 2013 Community I get the following error (in the LogIn.cshtml page).
CS0433: The type 'System.Web.Mvc.WebViewPage "exists in the elements c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll and c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll
I deleted all files from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files, cleaned the solution but the problem remains. How to fix it ?
EDIT
The Test project used the MVC 3, that was the reason
If you have already tried the above solutions and are still getting the same problem then try this one->
Go to your project folder and in there locate the bin folder --> Remove System.Web.Mvc.dll and System.Web.Mvc.xml from there.
You could check in your web.config files.
Check if the version is the same as you're using as reference.
Application web.config file:
<add assembly="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
and
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.1" />
And the Views web.config file:
<add assembly="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
In my example, my MVC dll is the version 3.0.1. But Visual Studio built my solution as if it were 3.0.0. So I had to map the references in the web.config files to 3.0.1.
Check if you are referencing both DLLs to your project.
Your project is reading in two assemblies that might be referenced in your project:
System.Web.MVC version 4.0.0.0 and in System.Web.MVC version 3.0.0.0
In your root web.config, near the bottom, you will have something like the following:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="4.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
For me, I simply changed the 'oldVersion' number to 1.0.0.0-4.0.0.1 so that this application will always use the 'newVersion'.

VS2012 NuGet update causing cryptic warnings on build

The recent Visual Studio 2012 update seems to have broke something in my build. I think it has to do with last week's nuget update.
NuGet package restore started.
All packages are already installed and there is nothing to restore.
NuGet package restore finished.
1>------ Rebuild All started: Project: Project1, Configuration: Debug Any CPU ------
1> Consider app.config remapping of assembly "Microsoft.Data.OData, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.6.0.0" [C:\Users\avianbc\Desktop\Project1\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "Microsoft.Data.Edm, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.6.0.0" [C:\Users\avianbc\Desktop\Project1\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Spatial, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.6.0.0" [C:\Users\avianbc\Desktop\Project1\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll] to solve conflict and get rid of warning.
1>c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
1> Project1 -> C:\Users\avianbc\Desktop\Project1\Project1\bin\Project1.dll
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
How could I resolve these warnings? I've had all kinda of weird side effects in my application since they have appeared such as: inconsistent model binding (related to the Edm assembly?).
As the message indicates you can fix these warning by mapping the assembly version 5.2 to version 5.6. You do this by editing the assemblyBinding of your config file. In this case, add the following XML:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
I'm not sure why you think this is cryptic, it's quite clear. You have more than one version of those packages installed (5.2 and 5.6) Some of your components are referencing 5.2 and some 5.6, and this is causing the warning. It's suggesting that you alias 5.2 to 5.6 so that the assemblies referencing 5.2 will use 5.6 instead.
This is probably no the best approach though, unless you have no control over those assemblies. You should probably just uninstall the 5.2 packages, and then update the nuget references to the 5.6 version and rebuild.

MSB3247: Found conflicts... error for EnttityFramework 4.4.00 to 5.0.0.0

This occurs in ASP.Net MVC 4 project.
I found an excellent suggestion to view MSBuild detailed output here. Seems like System.Web.Providers.dll is referencing 4.5.0.0 causing this error.
I attempted a Binding redirect in web.config under runtime -> assemblyBinding
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="1.0.0.0-4.4.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
When I rebuilt the project, I still got the below message:
Consider app.config remapping of assembly "EntityFramework,
Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version
"4.4.0.0" [] to Version "5.0.0.0"
[C:\Rhipheus\Cloudlene.Rhipheus\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll]
to solve conflict and get rid of warning.
I extended redirect to 4.5.0.0:
Consider app.config remapping of assembly "EntityFramework,
Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version
"4.5.0.0" [] to Version "5.0.0.0"
[C:\Rhipheus\Cloudlene.Rhipheus\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll]
to solve conflict and get rid of warning.
Same message but now the version reported is 4.5.0.0. I took the redirect up to 4.9.0.0 to no avail (same message with just the version's bumped matching my redirect).
Can someone point me to what I'm doing wrong? I appreciate in advance for not closing this as not constructive ;)
OK. Once I included 5.0.0.0, the warning went away. Guess, binding redirect must not only redirect older references but the 'primary reference' too.
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>

FluentNHibernate 1.1 / Castle 1.1 dependency

I would like to upgrade my FluentNHibernate to version 1.1, but I found out it uses Castle.Core 1.1.
I use Castle.Windsor 1.2 in my app which works with Castle.Core 1.2.
I now need to find a version of Castle.Windsor that uses this earlier version of Castle.Core, but I can't find it anywhere.
What do you recommend I should do?
Wait for a version of FluentNHibernate that uses the latest Castle.Core?
OR build FluentNHibernate 1.1 from source using the latest Castle.Core?
OR downgrade my Castle.Windsor version?
Only NHibernate.ByteCode.Castle.dll and Castle.DynamicProxy2.dll depend on Castle.Core.dll.
You can get them compiled against Castle.Core.dll 1.2 from the Castle ActiveRecord 2.1.1 release.
If you don't want to build FluentNHibernate against the lastest version of Castle, add this to your app.config/web.config file :
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.DynamicProxy2" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
<bindingRedirect oldVersion="2.1.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
<bindingRedirect oldVersion="1.1.0.0" newVersion="1.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>