davidebbo / WebActivator

Apache License 2.0
242 stars 49 forks source link

AspNet precompile error for WebActivator.1.5.2 #5

Open vicneanschi opened 11 years ago

vicneanschi commented 11 years ago

Hello! I have a project on .NET 4.0 which uses combres which requires WebActivator. I've updated WebActivator from 1.4.4 to 1.5.2 and started to get error on AspNet precompile:

error ASPRUNTIME : The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.. [D:\Work\src\trunk\EF\WM.EF.msbuild.xml]

davidebbo commented 11 years ago

Looks like the same as http://stackoverflow.com/questions/13748055/could-not-load-type-system-runtime-compilerservices-extensionattribute-from-as, which sounds like a pretty subtle issue. Do you have .NET 4.5 framework installed, or are you still running 4.0?

vicneanschi commented 11 years ago

I'm on 4.0. Will try to update framework. Thank you.

gdandy commented 11 years ago

This is a real issue when you are building with a machine that has .NET 4.5 installed and deploying to a Windows 2003 server. Windows 2003 servers do not support .NET 4.5, in fact it won't even let you try to install .NET 4.5 on a Windows 2003 server.

davidebbo commented 11 years ago

I understand this is a problem. What I'm less clear on is whether WebActivator is doing anything it should do differently here, or whether the issue is in the ASP.NET precompilation process.

damianog commented 11 years ago

I had the same problem today with quartznet

this could explain?

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

davidebbo commented 11 years ago

I read all that, but I still don't see how WebActivator itself could be doing something wrong here. It doesn't itself use ILMerge in any way. Are you calling ILMerge as part of your build? Or maybe indirectly via aspnet_merge?

damianog commented 11 years ago

OK WebActivator is not the problem, Quartznet was.

Today when I updated nuget packages:

WebActivator was updated from 1.5.2 to 1.5.3
Quartznet from 2.0.1 to 2.1.1 (you can see in https://github.com/quartznet/quartznet that It use ILMerge)

I use webactivator to start the a quartz static class scheduler in my asp.net web site by using [assembly: WebActivator.PostApplicationStartMethod(typeof(Scheduler), "Start")]

so the exception has been fired immediatly as I placed the Quartznet dll in the bin folder

I roll-back Quartznet to 2.0.1 and now all is running with WebActivator 1.5.3

maybe vicneanschi had a similar issue.

davidebbo commented 11 years ago

@damianog can you give more details about how you are publishing from your 4.5 machine to your 4.0 machine? Are you using ILMerge or aspnet_merge in that process?

damianog commented 11 years ago

The case where I happened to get the exception is in an old webform site updated to ASP.net 4.0 For publication I just use the Copy Web Site Tool to deploy into my Win2003 R2 web server.

Cause the update of the dlls by nuget update-package, after test that all run perfectly in my developing machine, (a Win7 with dotnet 4.5 installed, what I do was to sync my bin folder with the server destination and the newest Quartznet library started to hang the web server online compilation.