简体   繁体   中英

System.Web.PreApplicationStartMethodAttribute and ILMerge

Suppose I need to deploy a single assembly(Requirement). I will merge all assemblies using ILMerge. But lot of my assemblies have PreApplicationStartMethodAttribute(I don't have any control on all these assemblies). ILMerge will create a single assembly and PreApplicationStartMethodAttribute is only allowed once in a assembly. What should I do?

(from the comments)

In .NET 4.0, PreApplicationStartMethod can only be specified once per assembly:

PreApplicationStartMethodAttribute Class

 [AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple = false)] public sealed class PreApplicationStartMethodAttribute : Attribute 

but in .NET 4.5, multiple attributes in a single assembly are okay:

PreApplicationStartMethodAttribute Class

 [AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class PreApplicationStartMethodAttribute : Attribute 

so you can avoid the problem by upgrading to .NET 4.5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM