Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
How can I change the executable filename and icon for different build configurations?

I want to have a different icon and executable file name for different builds of my WPF application. The reason is that I have two different version of the app which are slightly different (just a few items disabled, color changes etc) So I used two different build configurations and the App.config transforms to do that for example in my transform I have several transformations like this

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
  <appSettings xdt:Transform="Replace"> 
    <add key="appTitle" value="Application Name 2"/> 
    <add key="appIcon" value="Icons\appplicationIcon2.ico"/> 
  </appSettings> 
</configuration> 

And then in my app I read the configuration setting for that property, appTitle or appIcon, and I perform some cosmetic or other changes to the app based on that.

But can I also use this to apply a change on the application icon itself (the one that gets embedded in the EXE, or the name of the EXE file?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In addition to the answer linked here https://stackoverflow.com/a/32977405/1462656 To change the application executable name on compile you must add the following as well to the property group

<AssemblyName>Name For Executable</AssemblyName>

So the property group should have these two additions

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Your Configuration Name|x64'">
    <ApplicationIcon>Icons\YourIconFilename.ico</ApplicationIcon>
    <AssemblyName>Your Application Name</AssemblyName>
    ...
  </PropertyGroup>

EDIT: I noticed that this does not have any effect on the Product Name or File Description as seen when you right click and view property details of the executable from File Explorer. To also have different values for Product and File Description do he following

  • Add Conditional Compilation Symbols in the Build properties for the project configuration
  • In the AssemblyInfo.cs do something like this
    #if APPONE
        [assembly: AssemblyTitle("App 1")]
    #else
        [assembly: AssemblyTitle("App 2")]
    #endif
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda