VS2015构建无效的.NET Core代码

时间:2016-12-29 13:27:07

标签: visual-studio-2015 .net-core

我的环境:

  • VS 2015,使用Update 3(14.0.25431.01)进行全新安装
  • Windows 10,最新更新
  • 已安装的.NET Core 1.0.3 SDK(LTS),.NET Core 1.1 SDK(当前)及其运行时
  • VS 2015工具预览版2(.NET核心版)
  • No ReSharper

enter image description here

我的dotnet信息

C:\Users\Ben>dotnet --info
.NET Command Line Tools (1.0.0-preview2-1-003177)

Product Information:
 Version:            1.0.0-preview2-1-003177
 Commit SHA-1 hash:  a2df9c2576

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64

enter image description here

为什么VS 2015认为,这里的构建很好?它无法编译。 CLI工作正常:

PM> dotnet build **/project.json
Project VS2015NetCore (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing
Compiling VS2015NetCore for .NETCoreApp,Version=v1.1
dotnet : C:\Program Files\dotnet\dotnet.exe compile-csc @C:\Users\Ben\documents\visual studio 
2015\Projects\VS2015NetCore\src\VS2015NetCore\obj\Debug\netcoreapp1.1\dotnet-compile.rsp returned Exit Code 1
At line:1 char:1
+ dotnet build **/project.json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (C:\Program File...ned Exit Code 1:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

C:\Users\Ben\documents\visual studio 2015\Projects\VS2015NetCore\src\VS2015NetCore\Program.cs(7,28): error CS0246: The type or namespace name 'ThisClassDoesNotExist' could not 
be found (are you missing a using directive or an assembly reference?)

2 个答案:

答案 0 :(得分:0)

我认为这是一个普遍的问题。但为什么?什么?

如果我修复错误,我会从CLI获得一般的非0错误:

enter image description here

关于dotnet cli repo,导致错误0x80008081 by an invalid argument

答案 1 :(得分:0)

重新安装我的机器。现在它有效。 通常的Windows问题解决方案......