dotnet build看不到引用的项目

时间:2017-03-22 13:30:19

标签: c# asp.net-core dotnet-cli

重现的步骤

创建net461核心webproject,引用VS2017中相同4.6.1的ClassLibrary。 在lib define

public class X
{
    [Required] // using System.ComponentModel.DataAnnotations;
    public bool Q { get; set; }
}

在webapp中使用它:new ClassLibrary1.X();

在VS中构建,在cmd中通过msbuild构建,确定。

运行dotnet restoredotnet build,您将获得

Class1.cs(5,14): error CS0234: The type or namespace name 'Net' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\xxx\Documents\Visual Studio 2017\Projects\coretest\ClassLibrary1\ClassLibrary1.csproj]

C:\Program Files\dotnet\sdk\1.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'C:\Users\xxx\Documents\Visual Studio 2017\Projects\coretest\ClassLibrary1\ClassLibrary1.csproj'. This can indicate a missing project reference. [C:\Users\xxx\Documents\Visual Studio 2017\Projects\coretest\WebApplication1\WebApplication1.csproj]

dotnet --info输出: .NET命令行工具(1.0.0)

产品信息:  版本:1.0.0  提交SHA-1哈希:e53429feb4

运行时环境:  操作系统名称:Windows  操作系统版本:10.0.14393  操作系统平台:Windows  RID:win10-x64  基本路径:C:\ Program Files \ dotnet \ sdk \ 1.0.0

0 个答案:

没有答案