简体   繁体   English

System.Web.PreApplicationStartMethodAttribute和ILMerge

[英]System.Web.PreApplicationStartMethodAttribute and ILMerge

Suppose I need to deploy a single assembly(Requirement). 假设我需要部署一个程序集(Requirement)。 I will merge all assemblies using ILMerge. 我将使用ILMerge合并所有程序集。 But lot of my assemblies have PreApplicationStartMethodAttribute(I don't have any control on all these assemblies). 但我的很多程序集都有PreApplicationStartMethodAttribute(我对所有这些程序集都没有任何控制权)。 ILMerge will create a single assembly and PreApplicationStartMethodAttribute is only allowed once in a assembly. ILMerge将创建一个程序集,PreApplicationStartMethodAttribute只允许在程序集中使用一次。 What should I do? 我该怎么办?

(from the comments) (来自评论)

In .NET 4.0, PreApplicationStartMethod can only be specified once per assembly: 在.NET 4.0中,每个程序集只能指定一次PreApplicationStartMethod

PreApplicationStartMethodAttribute Class PreApplicationStartMethodAttribute类

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

but in .NET 4.5, multiple attributes in a single assembly are okay: 但在.NET 4.5中,单个程序集中的多个属性是可以的:

PreApplicationStartMethodAttribute Class PreApplicationStartMethodAttribute类

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

so you can avoid the problem by upgrading to .NET 4.5. 因此,您可以通过升级到.NET 4.5来避免此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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