Remove or recreate temp\.net\application folder

  • Thread starter Thread starter Denis.Pasternak
  • Start date Start date
D

Denis.Pasternak

Guest
Hello,
I have a problem with my application. At some computers application does not starts with error at event logs:

Description: A .NET Core application failed.
Application: firefox.exe
Path: C:\Program Files\Mozilla Firefox\firefox.exe
Message: Error:
An assembly specified in the application dependencies manifest (firefox.deps.json) was not found:
package: 'runtimepack.Microsoft.NETCore.App.Runtime.win-x64', version: '3.1.1'
path: 'Microsoft.Win32.Registry.dll'
This is happens when some DLL lost in tem directory. For resolve this issue I need to remove all directory "\AppData\Local\Temp\.net\firefox\crzm4sor.ju1". After that application will create new one with DLLs and will start normal.





I don`t know why does it happens. But what can I do for resolve this issue?

I see different ways and different questions :)

1. How force recreate temp\.net\app folder with DLLs every time when application starts?

2. How can I remove that folder on close? I found how remove files on close, but this file are busy.

3. I can make group policy or powerhsell script which will remove temp folder, but it is no nice solution. I believe and really hope you will help me find a way out with 1-2 or other way.

Thank you.

If it can be helpful, here my application code.

using System;
using System.Diagnostics;
using System.Threading;
using System.IO;


namespace firefoxWatcher
{

static class firefoxWatcher
{
private static Mutex mutex = null;
[STAThread]


public static void Main()
{
const string appName = "firefox";
bool createdNew;
mutex = new Mutex(true, appName, out createdNew);
if (!createdNew)
{
//app is already running! Exiting the application
Console.WriteLine("Application is already running.");
return;
}
else
{
}

Console.WriteLine("Mutex passed");



// Start the process.
using (Process myProcess = Process.Start("C:\\Program Files\\Mozilla Firefox\\firefox_original.exe"))
{
// Display the process statistics until
// the user closes the program.
System.Threading.Thread.Sleep(3000);
Process[] localByName = Process.GetProcessesByName("firefox_original");
foreach (Process theprocess in localByName)
{

Console.WriteLine("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id);
Console.WriteLine($"Started process: {theprocess.HasExited}");

do
{
if (!theprocess.HasExited)
{
// Refresh the current process property values.
theprocess.Refresh();
Console.WriteLine();

// Display current process statistics.

Console.WriteLine($"running process: {theprocess.Id}");

if (theprocess.Responding)
{
Console.WriteLine("Status = Running");
}
else
{
Console.WriteLine("Status = Not Responding");
}
}
else
{
System.Threading.Thread.Sleep(100);


}
}
while (!theprocess.WaitForExit(1000));
}
}
}
}
}

Continue reading...
 
Back
Top