buunguyen / combres

ASP.NET and MVC performance optimization library ⛺
Other
123 stars 37 forks source link

Update-Package in NuGet #1

Closed alex1kirch closed 11 years ago

alex1kirch commented 11 years ago

After last update i found some issue with ilmerge tool.

[TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]

Detail about this issue. http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx

buunguyen commented 11 years ago

Combres doesn't use ilmerge. How did you see this error?

lamarant commented 11 years ago

@alex1kirch: I'm getting this error too (my application is .Net 4)...can you outline the steps to resolve please? This totally hosed my application...I can't build it even after uninstalling Combres. I originally installed via NuGet as well. Is there a fix?

UPDATE: After trying to correct the issue with the current version, and failing miserably, I ended up having to roll back my app. After rolling back I gave Combres another shot but this time installed the previous version via NuGet (see below). Everything works fine now. The current version must have been built using .Net Framework v4.5 which causes a pretty serious issue with ILMerge. For those of us that don't play well with low-level .Net core library setting stuff and excpect things to "just work" this ends up being a giant clusterF. Install via NuGet using the below and everything "just works" as expected.

PM> Install-Package combres.mvc -Version 2.2.2.6

http://nuget.org/packages/combres.mvc/2.2.2.6

alex1kirch commented 11 years ago

I think, that reason of the issue may be an assembly reference. For example, fasterflect. My application is Net4, too. VS2010 and VS2012 are installed on my host machine.

buunguyen commented 11 years ago

@alex1kirch if you remove fasterflect, does ilmerge work (Combres won't work, I just want to know that Fasterflect singlehandedly causes the issue). As a note, I built Combres to target .NET 3.5. It runs fine on my machine with VS2010 and VS2012 installed.

zaltar commented 11 years ago

It does seem to be Fasterflect that is causing this error. I recompiled Fasterflect and Combres using VS 2010 on a computer that does not have .NET 4.5 nor VS2012 installed and the error has gone away.

nato24 commented 11 years ago

It seems the latest nuget version was built w/ a different version of Fasterflect. Your build is expecting version 2.1.2.0, but nuget installs 2.1.0.8328.

After adding the expecting .Net binding in my web.config, everything works.

<runtime>
  <dependentAssembly>
    <assemblyIdentity name="Fasterflect" publicKeyToken="38d18473284c1ca7" />
    <bindingRedirect oldVersion="2.1.0.8328" newVersion="2.1.2.0" />
  </dependentAssembly>
</runtime>

Hope that helps.

richtea commented 11 years ago

The problem is that recent versions of Fasterflect (v2.1.1 and later) were built against .NET4.5 assemblies, in which ExtensionAttribute was moved from System.Core to mscorlib. This breaks for anyone running .NET4.0. See my comment here.

You can use ildasm (in PowerShell) to see the problem:

ildasm .\Fasterflect.dll /text | Select-String "mscorlib.*ExtensionAttribute"
buunguyen commented 11 years ago

I just pushed a release that references Fasterflect 2.1.0. Please try to see if that fixes the issue. Make sure you remove all assembly redirection to the latest version of Fasterflect.

richtea commented 11 years ago

That fixes the issue, thanks for doing it so quickly!