Updated to the latest AspNetCore.Mvc versions 1.1.2 with using the framework net452 I get the error at the bottom.
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options =>
{
options.AddPolicy("AllowSpecificOrigin",
builder => builder.WithOrigins("http://localhost:16964"));
});
services.AddMvc();
services.Configure<MvcOptions>(options =>
{
options.Filters.Add(new CorsAuthorizationFilterFactory("AllowSpecificOrigin"));
});
services.AddAutoMapper();
... other services
}
System.IO.FileLoadException was unhandled
FileName=Microsoft.Extensions.DependencyModel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
FusionLog=""
HResult=-2146234304
Message=Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=AutoMapper.Extensions.Microsoft.DependencyInjection
StackTrace:
at AutoMapper.ServiceCollectionExtensions.AddAutoMapper(IServiceCollection services)
at Api.Enterprise.Startup.ConfigureServices(IServiceCollection services) in "Project Path Removed Main project folder"\Startup.cs:line 99
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Api.Enterprise.Program.Main(String[] args) in "Project Path Removed Main project folder"\Program.cs:line 18
InnerException:
FileName=Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
FusionLog==== Pre-bind state information ===
LOG: DisplayName = Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
(Fully-specified)
LOG: Appbase = file:///"Project Path Removed Main project folder"/bin/Debug/net452/win7-x64/
LOG: Initial PrivatePath = NULL
Calling assembly : AutoMapper.Extensions.Microsoft.DependencyInjection, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: "Project Path Removed Main project folder"\bin\Debug\net452\win7-x64\Enterprise.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.0.0.0 redirected to 1.1.0.0.
LOG: Post-policy reference: Microsoft.Extensions.DependencyModel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
LOG: Attempting download of new URL file:///"Project Path Removed Main project folder"/bin/Debug/net452/win7-x64/Microsoft.Extensions.DependencyModel.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
HResult=-2146234304
Message=Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
InnerException: