net core 2 console app + linux
От: alex303  
Дата: 16.05.18 09:58
Оценка:
Вопрос из серии "что я делаю не так":

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.300-rc1-008673
 Commit:    f5e3ddbe73

Runtime Environment:
 OS Name:     centos
 OS Version:  7
 OS Platform: Linux
 RID:         centos.7-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.300-rc1-008673/

Host (useful for support):
  Version: 2.1.0-rc1
  Commit:  eb9bc92051

.NET Core SDKs installed:
  2.1.300-rc1-008673 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0-rc1-final [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0-rc1-final [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.0-rc1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download


dotnet restore проходит без ошибок

dotnet build
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 76.1 ms for /home/user/4/examples/Hello/Hello.csproj.
  You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452
/tmp/.NETCoreApp,Version=v2.0.AssemblyAttributes.cs(4,20): error CS0400: The type or namespace name 'System' could not be found in the global namespace (are you missing an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(10,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(11,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(12,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(13,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(14,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(15,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(16,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
/tmp/.NETCoreApp,Version=v2.0.AssemblyAttributes.cs(4,71): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
/tmp/.NETCoreApp,Version=v2.0.AssemblyAttributes.cs(4,99): error CS0246: The type or namespace name 'FrameworkDisplayName' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
/tmp/.NETCoreApp,Version=v2.0.AssemblyAttributes.cs(4,122): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(10,55): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(11,61): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(12,59): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(13,68): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(14,55): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(15,53): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(16,55): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
Program.cs(1,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
Program.cs(2,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
Program.cs(3,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
Program.cs(4,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
/tmp/.NETCoreApp,Version=v2.0.AssemblyAttributes.cs(2,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
/tmp/.NETCoreApp,Version=v2.0.AssemblyAttributes.cs(3,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(7,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
obj/Debug/netcoreapp2.0/Hello.AssemblyInfo.cs(8,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [/home/user/4/examples/Hello/Hello.csproj]
Program.cs(9,18): error CS0518: Predefined type 'System.Object' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
Program.cs(11,33): error CS0518: Predefined type 'System.String' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]
Program.cs(11,23): error CS0518: Predefined type 'System.Void' is not defined or imported [/home/user/4/examples/Hello/Hello.csproj]

Build FAILED.


сам проект — ерунда:
cat Hello.csproj
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <AssemblyName>Hello</AssemblyName>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <OutputType>Exe</OutputType>
  </PropertyGroup>

</Project>


cat Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Test
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("wellcome to dark side!");
        }
    }
}



Под виндой все работает... но там рантаймов больше. Еще стоят

sdk:
  1.1.9 [C:\Program Files\dotnet\sdk]
  2.1.3 [C:\Program Files\dotnet\sdk]

runtimes:
  Microsoft.NETCore.App 1.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Отредактировано 16.05.2018 10:13 alex303 . Предыдущая версия .
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.