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

386
Visualizações
Auto-Generated AppData/Local folder being "incorrectly" created

when I run a .net exe, a corresponding folder is created is created C:\Users\UserName\AppData\Local\AppName

inside this folder, another folder is created AppName_Url_ABCXYZ

inside this folder, yet another folder is created for the assembly version of the .net exe 0.2.28.0

can anyone explain how windows decide to create the second level folder AppName_Url_ABCXYZ?

i am having an issue when i increment my assembly version and perform a single file publish and run the resulting exe, a new AppName_Url_ABCXYZ folder is created containing the new assembly version folder.

this causes issues because it breaks the functionality of Properties.Settings.Default.Upgrade() as the settings to upgrade from are no longer in the expected directory

Good:

-AppData
 -Local
  -MyApp
   -MyApp_Url_ABCXYZ
    -0.2.13.0
    -0.2.14.0
    -0.2.15.0

Bad:

-AppData
 -Local
  -MyApp
   -MyApp_Url_ABC1
    -0.2.13.0
   -MyApp_Url_ABC2
    -0.2.14.0
   -MyApp_Url_ABC3
    -0.2.15.0

enter image description here

Update:

The information provided by @Richard Deeming indicates that the hash portion of the appdata folder is generated like so:

var uri = "file:///" + fullExePath; //or 'assemblyName.CodeBase' if vshost (you can check the 'FriendlyName')
uri = uri.ToUpperInvariant();

var ms = new MemoryStream();
var bSer = new BinaryFormatter();
bSer.Serialize(ms, uri);
ms.Position = 0;
var sha1 = new SHA1CryptoServiceProvider();
var hash = sha1.ComputeHash(ms);
var hashstring = ToBase32StringSuitableForDirName(hash);

which makes no sense as the exe path is not changing

this issue does not occur with a brand new WPF .net 6 app and incrementing the assembly version, so its something specific to my application.

examining the resulting exe's in windows explorer does not help, they seem identical.

Update:

I have been unable to determine why this is occurring in my project. I don't even know how to debug it. I've never made any intentional changes to this behavior.

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

0

Download the entire project package here – ConsoleApp1.zip

To demonstrate, let's create a simple console application:

enter image description here

and add a link to it:

<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />

We will also add the Settings.settings project properties file. As a result, we get a project in the following configuration:

enter image description here

After compiling in debug mode and running the result of ConsoleApp1.exe, we get the following picture along the path C:\Users\Administrator\AppData\Local\ConsoleApp1:

enter image description here

inside this folder there will be a folder with the version number of the program:

enter image description here

When compiling the release version and running the result of ConsoleApp1.exe, we get the following picture along the path C:\Users\Administrator\AppData\Local\ConsoleApp1:

enter image description here

inside this new folder there will also be a folder with the version number of the program:

enter image description here

It should be noted that the debug and release versions of the program create different folders. 

When you change the project version, new versions will appear in the debug and release folders, respectively:

enter image description here

enter image description here

The debug and release programs are different compilation "versions" of the same project, and different URLs are created to separate them.

Download the entire project package here – ConsoleApp1.zip

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