Linux下的dotnet构建

时间:2018-05-15 08:57:35

标签: c# .net

这就是我所拥有的:

enter image description here

当我做dotnet build WorldServer.sln

I receive the following error:

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

  Nothing to do. None of the projects specified contain packages to restore.
/usr/share/dotnet/sdk/2.1.200/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/venelin/wawsource/mmorpg/GameServer/WorldServer/WorldServer.csproj]

Build FAILED.

/usr/share/dotnet/sdk/2.1.200/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/venelin/wawsource/mmorpg/GameServer/WorldServer/WorldServer.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.38

甚至可以在Linux下构建Windows控制台应用程序项目。是否要在linux下构建一个exe或者它是一个程序文件,我可以在没有任何模拟器的情况下在linux下运行?

如果有可能我该怎么办?我该如何解决这个错误?

1 个答案:

答案 0 :(得分:0)

鉴于你从其他地方获得了这个项目并且它不是由你从头开始编写的,简短的回答 - 你无法构建它或在Linux上运行。它不应该是这样的。

唯一可能的方法是使用.NET 4.6.1在Windows上构建和运行,如错误消息中所述。

.NET Core不是运行应用程序的正确运行时。

编辑:如果您已编码,请按此official instruction how to port your code to .NET Core