我不能让VS2015与dotnet cli一起工作-我想使用VS2015编辑和测试VS2015核心项目,然后能够使用dotnet编译和运行它。然而,我所有的尝试都没有成功,这并不理想--我正准备在Windows上编写代码,然后使用Travis-Ci来充实。
这就是正在发生的事情:
VS2015 -> Dotnet cli
如果我为net创建VS2015“Console Application”项目(目标.Net Framework4.6.1),我将得到以下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"
}
}
}当VS2015使用这个项目时,编译和运行都很好。但是,由于网络核心点是跨平台兼容性的,我想通过dotcore cli来恢复和构建它(例如,做CI构建在Travis-ci上)。在此项目中运行dotnet restore时,我会得到以下错误:
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在Travis CI中尝试在Ubuntu14.04上可靠地恢复dotnet时也会出现同样的错误,但是除了win7 7-x86被Ubuntu所取代。
Dotnet CLI -> VS2015
如果我使用dotnet命令创建一个新项目,将得到以下project.json:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23811"
},
"frameworks": {
"dnxcore50": { }
}
}当从dotnet命令运行时,该项目编译并运行良好。但是我想让它与VS2015一起工作,因为它非常舒适,所以我打开project.json作为一个项目,一切似乎都在工作(没有冲突或显示的依赖关系错误)。
我将命令条目添加到json:“commands”: { “ConsoleAppTest2”: “ConsoleAppTest2”}并命中CTRL+F5 -因此我受到以下错误的欢迎:
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()我刚刚开始使用net,不知道如何解决这个问题。我担心这可能与使用dotnet核心的旧版本的VS2015有关(在打开dotnet新创建的项目时,还原包的VS2015输出包含以下一行:C:\Users\{user}\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin\dnx.exe )。如果这一点很重要,那么在msi.install安装VS2015很久之后,我就已经安装了dotnet。
统计数据
我认为这些数据可能是有用的:
OS:Windows 10 x64 En
VS:VisualStudioEnterprise2015版本14.0.25123.00更新2(我更新了所有建议的更新)
运行dnx --version:Microsoft .NET执行环境版本的结果版本: 1.0.0-rc1-16609类型: CoreClr体系结构: x64操作系统名称: Windows版本: 10.0运行时Id: win10-x64
运行where dnx:C:\Users{{user}}.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-rc1-update2\bin\dnx.exe的结果
运行dnvm version:1.0.0.rc1-15540的结果
运行where dnvm:C:\user{{user}.dnx\bin\dnvm.cmd C:\Program \Microsoft DNX\Dnvm\dnvm.cmd的结果
运行dotnet --version:.NET命令行工具的结果(1.0.0-β-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运行where dotnet:C:\ProgramFiles\dotnet\bin\dotnet.exe的结果
发布于 2016-05-04 19:20:07
你的假设是正确的。VS中的工具还没有更新。就在两周前,微软还为dotnet提供了visual工具的内部版本。RC1 (基于is 2015.2DNX的工具)和尚未发布的新的dotnet之间发生了很大变化。
等两周。RC2即将到来,最有可能的是工具支持。
https://stackoverflow.com/questions/37025262
复制相似问题