【问题标题】:Project not build in active configuration Visual Studio MacOS .net Core项目未在活动配置中构建 Visual Studio MacOS .net Core
【发布时间】:2017-06-06 00:21:02
【问题描述】:

我在 Visual Studios MacOS Preview 中创建了一个控制台应用程序(.Net Core)。在项目解决方案中,我看不到我的 program.cs 也没有其他东西可用,它说 Project not built in active configuration

而项目解决方案应该是这样的

我已经安装了.net core for macOS。还使用 Homebrew 配置完成。我已经在 osx 中安装了 openssl 和 openssl@1.1,所以当我尝试用 homebrew 重新安装 openssl 时,它说

Warning: openssl is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version

另一方面,确保 .net 核心工作正常。我刚刚在 Visual Studio Code 中编译了 .net core C# 应用程序。

【问题讨论】:

  • 您更新到预览版 3 了吗?它仍然是一个预览版本,所以会出现错误。
  • @LexLi 是更新了,但这对我来说看起来不是错误。这是一些配置问题

标签: c# macos visual-studio xamarin .net-core


【解决方案1】:

您似乎没有安装.NET Core SDK 1.0.0-rc4

如果没有安装 SDK,Visual Studio for Mac Preview 3 将找不到任何要导入的 SDK MSBuild 文件,这会导致项目中没有添加任何调试/发布配置。

Visual Studio for Mac 在 /usr/local/share/dotnet/sdk/ 目录中查找最新的 sdk。如果该目录中没有子目录,则说明您没有安装 SDK。

此外,项目中没有显示任何文件,如果没有找到 SDK,也会出现这种情况。

目前 Visual Studio for Mac 没有关于缺少 SDK 的良好错误报告,但计划在未来发布。

【讨论】:

  • 错误已修复,但现在我收到此错误error MSB4057: The target "Build" does not exist in the project google 搜索但没有修复 asp.net 的任何修复
  • 这里的问题与@AbhimanyuAryan 相同,在预览版 3 更新后出现错误 MSB4057:项目中不存在目标“Build”
  • @Giuseppe - 您需要最新版本的 Mono 4.8 才能使构建工作 - dl.xamarin.com/MonoFrameworkMDK/Macx86/…
  • @MattWard 为什么需要 Mono 才能工作 - 它是 VS 的依赖项吗?
  • 是的,它是一个依赖项。目前,出于技术原因,更新程序不会将其显示为依赖项。 Visual Studio (Windows) 依赖 MSBuild 15 来编译 .NET Core 项目。 Visual Studio for Mac 也依赖于 MSBuild 15,它随 Mono 4.8 一起提供。 Mono 4.8 的早期版本不包括支持编译 .NET Core 项目的最新版本。
【解决方案2】:

我在 VS 更新到 build 1077 后也遇到了同样的问题。要解决这个问题,你只需要安装 .NET Core SDK 1.0.0-rc4 并重新安装 Mono 4.8,你可以得到它 here

这些信息是我从更新日志页面https://developer.xamarin.com/releases/vs-mac/preview/vs-mac-preview1/得到的

我希望这会有所帮助。

【讨论】:

  • 这会修复所有错误 MSB4057 BUILD does not exist in the project 吗?
  • 谢谢!为我工作。
【解决方案3】:

对我来说是 .netcore 库项目。

从解决方案中删除项目(右键单击项目>删除>删除)

然后再次添加。 (右键单击解决方案>添加>添加现有项目..)

确保 SDK 已按照 Matt Ward 所述安装。

【讨论】:

    猜你喜欢
    • 2017-08-08
    • 1970-01-01
    • 2023-03-10
    • 2018-06-02
    • 1970-01-01
    • 2021-02-04
    • 1970-01-01
    • 1970-01-01
    • 2016-11-15
    相关资源
    最近更新 更多