Question: ASP.NET 5 Project Not Properly Targeting .NET 4.6.1 and cannot be debugged

Question

ASP.NET 5 Project Not Properly Targeting .NET 4.6.1 and cannot be debugged

Answers 1
Added at 2016-01-15 19:01
Tags
Question

I am running ASP.NET5 RC1 UPDATE1. In project.json my framework is "dnx461". When I try to debug (in IIS Express with DNX_IIS_RUNTIME_FRAMEWORK set to DNX461) I get the following warning:

Warning MSB3274 The primary reference "C:\mydll.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5.1". WebTest C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets

"mydll" is a .NET 4.6.1 DLL. When I try to debug with IIS Express, I get the following output in the debug window:

'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'Microsoft.Dnx.Host.Clr'. Cannot find or open the PDB file. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\devuser.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\Microsoft.Dnx.Host.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\devuser.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\Microsoft.Extensions.PlatformAbstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\devuser.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\Microsoft.Dnx.Loader.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\devuser.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\Microsoft.Dnx.ApplicationHost.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\devuser.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\Microsoft.Dnx.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\devuser.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\Microsoft.Dnx.Compilation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dnx.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\devuser.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\Microsoft.Dnx.Compilation.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The program '[16968] dnx.exe' has exited with code 1 (0x1). The program '[16968] dnx.exe: Program Trace' has exited with code 0 (0x0). The program '[20612] iisexpress.exe: Program Trace' has exited with code 0 (0x0). The program '[20612] iisexpress.exe' has exited with code -1 (0xffffffff).

I am using VS2015 with Update 1. How do I fix this?

Answers to

ASP.NET 5 Project Not Properly Targeting .NET 4.6.1 and cannot be debugged

nr: #1 dodano: 2016-01-15 19:01

Change your target framework to .NET 4.6.1.

Right click your project in the solution explorer and select properties. Then, under the Application tab, select a new Target framework.

Source Show
◀ Wstecz