assembly crashing my asp.net 4.0
Asked Answered
R

3

8

I am getting this error "could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'."

whenever i include quartz.net's dlls in my web site's bin directory and reference it in code. I am sure it has to do with the wrong .net framework.

my asp.net site is using target framework 4.0 i am using the .net 4 quartz.net files

and my IIS app pool (classic .net pool) is set to run .net 4.0 frework.

I am not sure where to start but what I know for sure is remove Quartz and I am looking good again (minus the scheduling)

Risibility answered 13/4, 2012 at 10:15 Comment(0)
S
5

This was a problem introduced in the final version because Quartz.Net was compiled against the 4.5 framework. Take a look at this thread where the issue was reported. A fixed version of the dll is available.

Sessile answered 13/4, 2012 at 20:17 Comment(0)
L
6

ExtensionAttribute class is required to use extension methods in C#. In .NET Framework 4.0 this class is in assembly System.Core.dll, but in .NET Framework 4.5 class was moved to mscorlib.dll. I guess that problem is, that Quartz.dll (or some other assembly) was compiled on computer with .NET Framework 4.5 installed thus expecting ExtensionAttribute in mscorlib.dll, which is not there on computers with only .NET Framework 4.0.

I believe that recompiling Quartz on computer without .NET Framework 4.5 should solve the problem. Also installing .NET Framework 4.5 on server with IIS should help, but I wouldn't recommend it since it is still beta.

Lakia answered 13/4, 2012 at 19:38 Comment(1)
Or, Ensure the reference assemblies are installed on the build server which is building the faulty DLLs, marcgravell.blogspot.co.nz/2012/09/…Adal
S
5

This was a problem introduced in the final version because Quartz.Net was compiled against the 4.5 framework. Take a look at this thread where the issue was reported. A fixed version of the dll is available.

Sessile answered 13/4, 2012 at 20:17 Comment(0)
T
1

Have you tried adding the reference to mscorlib assembly and set Copy Local to true?

Reading here :

This issue has to do with how ILMerge.exe is run. Type forwarding (in this case of the ExtensionAttribute type) is considered a non-breaking change, in the sense that it is transparent, in the supported scenarios, to the runtime, as well as our compilers. Compilers or compiler-like tools (which ILMerge is one of) are expected to support type forwarding, just like they are expected to support other features of the runtime. Furthermore, the supported way of running compilers is by explicitly and completely referencing the reference assemblies of the appropriate Multi-Targetting pack.

Torino answered 13/4, 2012 at 10:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.