D
Denis.Pasternak
Guest
Hello, I usually write scripts in powershell, however the task requires writing an agent in C#.
After publish application I have files: firefoxWatcher.dll and firefoxWatcher.exe
If I run application, it returns me error
"A fatal error occurred. The required library hostfxr.dll could not be found"
I understand that is the code I use libraries that are not on the destination computer. If I install ".NET Core runtime", problem is gone, But I can`t install Dotnet on each computer it is over 500 Mb, for run 200 Kb application?
I try to find what DLL I need using process monitor. Program trying toch a lot off dll in "C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1." and other folders.
How I can run application without ".NET Core runtime" installation. Please HELP
here code:
using System;
using System.Diagnostics;
namespace firefoxWatcher
{
class firefoxWatcher
{
public static void Main()
{
// Start the process.
using (Process myProcess = Process.Start("C:\\Program Files\\Mozilla Firefox\\firefox.exe"))
{
// Display the process statistics until
// the user closes the program.
System.Threading.Thread.Sleep(5000);
Process[] localByName = Process.GetProcessesByName("firefox");
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}");
Console.WriteLine("-------------------------------------");
if (theprocess.Responding)
{
Console.WriteLine("Status = Running");
}
else
{
Console.WriteLine("Status = Not Responding");
}
}
}
while (!theprocess.WaitForExit(5000));
}
}
}
}
}
Continue reading...
After publish application I have files: firefoxWatcher.dll and firefoxWatcher.exe
If I run application, it returns me error
"A fatal error occurred. The required library hostfxr.dll could not be found"
I understand that is the code I use libraries that are not on the destination computer. If I install ".NET Core runtime", problem is gone, But I can`t install Dotnet on each computer it is over 500 Mb, for run 200 Kb application?
I try to find what DLL I need using process monitor. Program trying toch a lot off dll in "C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1." and other folders.
How I can run application without ".NET Core runtime" installation. Please HELP
here code:
using System;
using System.Diagnostics;
namespace firefoxWatcher
{
class firefoxWatcher
{
public static void Main()
{
// Start the process.
using (Process myProcess = Process.Start("C:\\Program Files\\Mozilla Firefox\\firefox.exe"))
{
// Display the process statistics until
// the user closes the program.
System.Threading.Thread.Sleep(5000);
Process[] localByName = Process.GetProcessesByName("firefox");
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}");
Console.WriteLine("-------------------------------------");
if (theprocess.Responding)
{
Console.WriteLine("Status = Running");
}
else
{
Console.WriteLine("Status = Not Responding");
}
}
}
while (!theprocess.WaitForExit(5000));
}
}
}
}
}
Continue reading...