unitycontainer / aspnet-mvc

ASP.NET MVC 5 Adapter
Apache License 2.0
13 stars 10 forks source link

Incompatibility issues when upgrading from version 4.0.1 to version 5.0.8 on Visual Studio 2013 #6

Closed dgandini closed 7 years ago

dgandini commented 7 years ago

The nameof statement and the delegate syntax are incompatible with .Net Framework 4.5.1

Issue 1 - The nameof statement (UnityMvcActivator.cs)

[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(MyProject.UnityMvcActivator), nameof(MyProject.UnityMvcActivator.Start))]
[assembly: WebActivatorEx.ApplicationShutdownMethod(typeof(MyProject.UnityMvcActivator), nameof(MyProject.UnityMvcActivator.Shutdown))]

Issue 2 - The delegate that returns the configured container (UnityConfig.cs) public static IUnityContainer Container => container.Value;

Workarounds UnityMvcActivator.cs

[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(MyProject.UnityMvcActivator), "Start")]
[assembly: WebActivatorEx.ApplicationShutdownMethod(typeof(MyProject.UnityMvcActivator), "Shutdown")]

UnityConfig.cs public static IUnityContainer Container { get { return container.Value; } }

ENikS commented 7 years ago

The issues you are mentioned related to tool chain you are using and not the framework. The syntax is compiled just fine for NET 4.0, 4.5, and etc. using more modern compilers.

It does not make any sense to regres library for the tool (Visual Studio 2013) that even Microsoft no longer supports.

dgandini commented 7 years ago

It does not make any sense to regres library for the tool (Visual Studio 2013) that even Microsoft no longer supports.

I agree with you. My intention is just help others who may have the same problem.