简体   繁体   中英

Heroku deploy .net console application

I'm trying to deploy my console app(.net core 3.1) to heroku.

I don't have much experience with it. I have a buildpack and that's all I have. Tried to deploy with that buildpack.

I got following error

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'

following is my root file: 在此处输入图像描述 Anyone got idea how to fix this?

If you already have Assemblyinfo.cs you can remove that file and add the following in.csproj file

<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>

Else if you need to keep the assemblyinfo.cs you will have to add the following to the.csproj to avoid regenerating the assemblyinfo properties which will be duplicated

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

can test by running: dotnet build command

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM