Is it possible to add icone to a program by creating in NET.core (Windows)?

Asked

Viewed 113 times

4

I’ve only used the line commands dotnet, both to generate projects and to generate solutions (.sln), however I do not know if it is possible to use resource.rc directly with dotnet with something like:

MAINICON  ICON  "icon.ico"

Being with resource.rc or other means I would like to know if this is possible to be done in . net-core, or if I will need some intermediary or something else

  • what is the version? somewhere I read that I was going to have it in the 3.0

  • @Leandroangelo I am in 3.1 (netcoreapp3.1)

  • @Itwasn'tme yes. To distribute the app with icon.

  • @Itwasn'tme I did not create any sln, I created the csproj, but this is irrelevant, it is the basic with net-core and not net-framework, ie use everything with line command dotnet new ... (https://docs.microsoft.com/pt-br/dotnet/coretools/dotnet-new?tabs=netcore22), in my case dotnet new console, to create a "console application" and publish dotnet publish -c Release (https://docs.microsoft.com/pt-br/dotnet/core/tools/dotnet-publish?tabs=netcore21)

1 answer

3


Today I went to perform a test and apparently the tag works on netcoreapp3.1:

<ApplicationIcon>nome.ico</ApplicationIcon>

The logical design has to be an application, in my case I created a console application:

mkdir projeto1
cd projeto1
dotnet new console

Then I was generated the projeto1.csproj, I opened it and edited it this way:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <ApplicationIcon>nome.ico</ApplicationIcon>
  </PropertyGroup>

</Project>

So then I executed the dotnet run and both using the flags -c Debug how much in -c Release (and Publish too) this works, the example I did:

icone no projeto csproj para net core

So I executed dotnet build and I got what I expected:

executável com icone

Browser other questions tagged

You are not signed in. Login or sign up in order to post.