- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在使用 dotnet
从命令行构建一个 .NET Core C# 项目。该项目有多个具有 main
方法的类。因此我得到了错误:
$ dotnet build
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
Test.cs(18,28): error CS0017: Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
Build FAILED.
传递 /main
开关会导致错误:
$ dotnet build /main:Test
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1001: Unknown switch.
Switch: /main:Test
如何将 /main
开关传递给 dotnet
命令?
最佳答案
您可以编辑您的 csproj 以定义要使用的类(在 PropertyGroup
内):
<StartupObject>foo.Program2</StartupObject>
或通过以下方式在命令行上指定此 MSBuild 属性:
$ dotnet build foo.csproj -p:StartupObject=foo.Program2
在哪里
namespace foo
{
class Program2{ public static void Main() {} }
}
关于c# - 'dotnet build' 指定主要方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43365254/
我在 Ubuntu v16.04 上安装了 dotent core。问题是当我尝试使用 dotnet user-secrets 时它说:未找到匹配命令“dotnet-user-secrets”的可执行
好。这似乎是我看到答案时会面对的问题类型。 所以... 为什么要打扰 dotnet build做之前dotnet publish ? build自动执行 restore .凉爽的。 好像publish
我正在尝试创建一个 dotnet 新模板的 NuGet 包。我创建了一个 nuspec 文件来设置包的详细信息,它位于我的内容文件夹旁边,其中包含我想要打包的所有内容: My.
我正在尝试使用'dotnet dev-certs'工具导出https证书以包含在Docker镜像中。现在我正在使用: dotnet dev-certs https -v -ep $(HOME)\.as
我昨天从 .Net 5 更新到 .Net 6,现在我的项目无法从 dotnet run 开始。然后我得到错误: Building... warn: Microsoft.AspNetCore.Serve
我使用 dockerfile 成功构建,但是当我尝试从构建镜像运行新容器时,出现以下错误: 我必须为解决方案做什么? Error : /bin/sh: 1: [dotnet,: not found d
我有一个引用其他几个项目的 .NET Core 3 项目。我的主根项目有一个 Release-X构建配置,但其他项目只有 Release配置,无匹配 Release-X配置。 当我尝试使用这个发布我的
我的 dotnet new 列表中有许多“孤立的”dotnet 模板。 它们不再存在于我的驱动器上,因为我删除了文件夹,所以我不能 dotnet new --uninstall。 有没有办法从列表中删
编辑: 以下是最初与标题一起发布的前一个问题 xunit show ITestOutputHelper output when run in the console 经过调查(见评论),这个问题仍然非
来自 docs.microsoft.com: dotnet build - Builds a project and all of its dependencies. dotnet run - Run
我有一个 Dotnet 核心项目,我试图在其中安装 Microsoft.EntityFrameworkCore.Tools.Dotnet 以使用迁移。我在 Mac 上,所以我使用 MySql.Data
我已经在这个问题上徘徊了很长一段时间,但仍然没有找到答案,也没有其他帖子处理同样的问题。 我已经发布了一个 .net 5.0 网站,如果我在同一个发布的文件夹中运行 dotnet,一切都会正常运行。在
我正在尝试使用 CLI dotnet 命令复制以下 Azure 管道: - task: DotNetCoreCLI@2 inputs: command: publish publi
假设这个文件夹结构 SampleApp global.json Src Web pro
我正在使用dotnet watch命令来运行asp.net core项目。但是,默认情况下,它选择 Production 作为环境。 我已经尝试了这两个选项: 1) > dotnet watch AS
我正在尝试在 Linux 主机上的官方 Microsoft/dotnet 镜像之外的容器中构建一个 dotnet 项目,因为该镜像与 Windows 和 Linux 都兼容。我只有 linux 主机,
我不是 Linux 用户,所以这可能是一个简单的修复,但我已经尝试了以下方法: 首先我使用命令 curl -sSL https://dot.net/v1/dotnet-install.sh | bas
我在发布配置文件中遇到了 Visual Studio 和 EF 迁移的奇怪情况。鉴于: Visual Studio 2019 v16.4 .NET 核心项目。目标 .NET Core 3.1 EF 3
我已经安装了 .NET Core 1.0.1 以与 VS 2015 Update 3 一起使用,并且以管理员身份运行(在 Windows 8.1 x64 上)。 如果我创建任何 .NET Core 项
我正在尝试为dotnet core 2创建开发Dockerfile。到目前为止,我的工作是: FROM microsoft/aspnetcore-build:2.0 VOLUME /app WORKD
我是一名优秀的程序员,十分优秀!