I cannot make VS2015 work with dotnet cli - I would like to edit and test may dotnet-core project using VS2015 and then have the ability to compile & run it using dotnet cli. However all my attempts to make it so were not successful, which is not ideal - I am aming for writing code on Windows and then using Travis-Ci for bulding.
So this is what is happening:
VS2015 -> Dotnet cli
If I create VS2015 “Console Application” Project (Target .Net Framework 4.6.1) for net-core, I get the following project.json:
{
"version": "1.0.0-*",
"description": "ConsoleAppTest Console Application",
"authors": [ "Nemo" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
},
"commands": {
"ConsoleAppTest": "ConsoleAppTest"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Console": "4.0.0-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
This project compiles and runs just fine when used by VS2015.
But as net-core point is cross-platform compatibility, I would like to restore and build it via dotcore cli (and for example, do CI builds on Travis-ci).
When running dotnet restore inside this project, I get the following error:
log : Restoring packages for {my_path}\Projects\ConsoleAppTest\src\ConsoleAppTest\project.json...
error: System.Console 4.0.0-beta-23516 provides a compile-time reference assembly for System.Console on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Threading 4.0.11-beta-23516 provides a compile-time reference assembly for System.Threading on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Dynamic.Runtime 4.0.0 provides a compile-time reference assembly for System.Dynamic.Runtime on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Linq.Expressions 4.0.0 provides a compile-time reference assembly for System.Linq.Expressions on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.IO 4.0.0 provides a compile-time reference assembly for System.IO on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Threading.Tasks 4.0.0 provides a compile-time reference assembly for System.Threading.Tasks on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Text.Encoding 4.0.0 provides a compile-time reference assembly for System.Text.Encoding on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: Some packages are not compatible with DNXCore,Version=v5.0 (win7-x64).
error: System.Console 4.0.0-beta-23516 provides a compile-time reference assembly for System.Console on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.Threading 4.0.11-beta-23516 provides a compile-time reference assembly for System.Threading on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.Dynamic.Runtime 4.0.0 provides a compile-time reference assembly for System.Dynamic.Runtime on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.Linq.Expressions 4.0.0 provides a compile-time reference assembly for System.Linq.Expressions on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.IO 4.0.0 provides a compile-time reference assembly for System.IO on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.Threading.Tasks 4.0.0 provides a compile-time reference assembly for System.Threading.Tasks on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.Text.Encoding 4.0.0 provides a compile-time reference assembly for System.Text.Encoding on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: Some packages are not compatible with DNXCore,Version=v5.0 (win7-x86).
info : Committing restore...
log : Restore failed in 520ms.
Errors in {my_path}\Projects\ConsoleAppTest\src\ConsoleAppTest\project.json
System.Console 4.0.0-beta-23516 provides a compile-time reference assembly for System.Console on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
System.Threading 4.0.11-beta-23516 provides a compile-time reference assembly for System.Threading on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
System.Dynamic.Runtime 4.0.0 provides a compile-time reference assembly for System.Dynamic.Runtime on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
System.Linq.Expressions 4.0.0 provides a compile-time reference assembly for System.Linq.Expressions on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
System.IO 4.0.0 provides a compile-time reference assembly for System.IO on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
System.Threading.Tasks 4.0.0 provides a compile-time reference assembly for System.Threading.Tasks on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
System.Text.Encoding 4.0.0 provides a compile-time reference assembly for System.Text.Encoding on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
Some packages are not compatible with DNXCore,Version=v5.0 (win7-x64).
System.Console 4.0.0-beta-23516 provides a compile-time reference assembly for System.Console on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
System.Threading 4.0.11-beta-23516 provides a compile-time reference assembly for System.Threading on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
System.Dynamic.Runtime 4.0.0 provides a compile-time reference assembly for System.Dynamic.Runtime on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
System.Linq.Expressions 4.0.0 provides a compile-time reference assembly for System.Linq.Expressions on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
System.IO 4.0.0 provides a compile-time reference assembly for System.IO on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
System.Threading.Tasks 4.0.0 provides a compile-time reference assembly for System.Threading.Tasks on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
System.Text.Encoding 4.0.0 provides a compile-time reference assembly for System.Text.Encoding on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
Some packages are not compatible with DNXCore,Version=v5.0 (win7-x86).
NuGet Config files used:
{another_path}\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
The same error appears while attempting to dotnet restore it on Ubuntu 14.04 Trusty in Travis CI, but except win7-x86 is replaced with Ubuntu.
Dotnet CLI -> VS2015
If I create a new project using dotnet new command, I get the following project.json:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23811"
},
"frameworks": {
"dnxcore50": { }
}
}
This project compiles and runs just fine when run from dotnet command.
But I would like to make it work with VS2015 as it is very comfortable IDE – so I open project.json as a project, everything seems to be working (no conflicts or errors in dependencies shown).
I add commands entry to json: “commands”: { “ConsoleAppTest2”: “ConsoleAppTest2”} and hit CTRL+F5 - I am therefore greeted with following error:
System.IO.FileLoadExpection: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definiton does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.Reflection.RuntimeAssembly.GetEntryPoint(RuntimeAssembly assembly, ObjectHandleOnStack retMethod)
at System.Reflection.RuntimeAssembly.get_EntryPoint()
I have just started working with net-core and have no clue how to solve this.
I fear it might have to do with VS2015 using old version of dotnet core ( while opening dotnet new created project, VS2015 output of restoring packages contains the following line:
C:\Users\{user}\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin\dnx.exe ).
If this is of importance, I have installed dotnet cli from msi.install long after VS2015 was installed.
Stats
The stats I think may be useful:
OS: Windows 10 x64 En
VS: Visual Studio Enterprise 2015 Version 14.0.25123.00 Update 2 (I am up to date all suggested updates)
Result of running dnx --version:
Microsoft .NET Execution environment
Version: 1.0.0-rc1-16609
Type: CoreClr
Architecture: x64
OS Name: Windows
OS Version: 10.0
Runtime Id: win10-x64
Result of running where dnx:
C:\Users{{user}}.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-rc1-update2\bin\dnx.exe
Result of running dnvm version: 1.0.0.rc1-15540
Result of running where dnvm:
C:\Users{{user}}.dnx\bin\dnvm.cmd
C:\Program Files\Microsoft DNX\Dnvm\dnvm.cmd
Result of running dotnet --version:
.NET Command Line Tools (1.0.0-beta-001598)
Product Information:
Version: 1.0.0-beta-001598
Commit Sha: 7582649f88
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
Runtime Id: win10-x64
Result of running where dotnet:
C:\Program Files\dotnet\bin\dotnet.exe