Heroku deploy. net консольное приложение - PullRequest
0 голосов
/ 03 мая 2020

Я пытаюсь развернуть мое консольное приложение (. net core 3.1) на heroku.

У меня нет особого опыта работы с ним. У меня есть buildpack, и это все, что у меня есть. Пытался развернуть с помощью этого пакета сборки.

Я получил следующую ошибку

C:\Users\SYDNEY\Desktop\twitchbot>git push heroku master
Enumerating objects: 546, done.
Counting objects: 100% (546/546), done.
Delta compression using up to 16 threads
Compressing objects: 100% (454/454), done.
Writing objects: 100% (546/546), 25.76 MiB | 658.00 KiB/s, done.
Total 546 (delta 159), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Core .NET app detected
remote: > Installing dotnet
remote: -----> Removing old cached .NET version
remote: -----> Fetching .NET SDK
remote: -----> Fetching .NET Runtime
remote: -----> Export dotnet to Path
remote: -----> Project File
remote: > /tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj
remote: -----> Project Name
remote: > twitchbot
remote: > publish /tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj for Release
remote:
remote: Welcome to .NET Core 3.1!
remote: ---------------------
remote: SDK Version: 3.1.201
remote:
remote: ----------------
remote: Explore documentation: https://aka.ms/dotnet-docs
remote: Report issues and find source on GitHub: https://github.com/dotnet/core
remote: Find out what's new: https://aka.ms/dotnet-whats-new
remote: Learn about the installed HTTPS developer cert: https://aka.ms/aspnet-core-https
remote: Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
remote: Write your first app: https://aka.ms/first-net-core-app
remote: --------------------------------------------------------------------------------------
remote: Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
remote: Copyright (C) Microsoft Corporation. All rights reserved.
remote:
remote:   Restore completed in 5.22 sec for /tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj.
remote: obj/Release/netcoreapp3.1/linux-x64/twitchbot.AssemblyInfo.cs(13,12): error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute [/tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj]
remote: obj/Release/netcoreapp3.1/linux-x64/twitchbot.AssemblyInfo.cs(14,12): error CS0579: Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute [/tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj]
remote: obj/Release/netcoreapp3.1/linux-x64/twitchbot.AssemblyInfo.cs(15,12): error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute [/tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj]
remote: obj/Release/netcoreapp3.1/linux-x64/twitchbot.AssemblyInfo.cs(17,12): error CS0579: Duplicate 'System.Reflection.AssemblyProductAttribute' attribute [/tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj]
remote: obj/Release/netcoreapp3.1/linux-x64/twitchbot.AssemblyInfo.cs(18,12): error CS0579: Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute [/tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj]
remote: obj/Release/netcoreapp3.1/linux-x64/twitchbot.AssemblyInfo.cs(19,12): error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute [/tmp/build_2de1ae7d9c84b2a5a6a6bd96b528c219/twitchbot.csproj]
remote:  !     Push rejected, failed to compile Core .NET app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to csydneybot.
remote:
To https://git.heroku.com/csydneybot.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/csydneybot.git'

Мой файл root: enter image description here Кто-нибудь получил идею, как это исправить

1 Ответ

0 голосов
/ 03 мая 2020

Если у вас уже есть Assemblyinfo.cs, вы можете удалить этот файл и добавить следующее в файл .csproj

<PropertyGroup>
    <Company>Name</Company>
    <Authors>Author</Authors>
    <Version>1.0.0</Version>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
    <FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>

  <PropertyGroup>
    <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
  </PropertyGroup>

Иначе, если вам нужно сохранить файл assemblyinfo.cs, вам нужно добавить следующее в .csproj, чтобы избежать регенерации свойств assemblyinfo, которые будут дублироваться

  <PropertyGroup>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>

, можно проверить, выполнив: dotnet build command

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...