diff --git a/build/scripts/Build.fs b/build/scripts/Build.fs
index 25eda918f..0f50b0f7f 100644
--- a/build/scripts/Build.fs
+++ b/build/scripts/Build.fs
@@ -218,7 +218,7 @@ module Build =
agentDir.Create()
// copy startup hook to root of agent directory
- !! (Paths.BuildOutput "ElasticApmAgentStartupHook/netcoreapp2.2")
+ !! (Paths.BuildOutput "ElasticApmAgentStartupHook/netstandard2.0")
|> Seq.filter Path.isDirectory
|> Seq.map DirectoryInfo
|> Seq.iter (copyDllsAndPdbs agentDir)
@@ -231,14 +231,14 @@ module Build =
|> Seq.iter (copyDllsAndPdbs (agentDir.CreateSubdirectory(sprintf "%i.0.0" getCurrentApmDiagnosticSourceVersion.Major)))
// assemblies compiled against older version of System.Diagnostics.DiagnosticSource
- !! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netcoreapp2.2" oldDiagnosticSourceVersion.Major))
+ !! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netstandard2.0" oldDiagnosticSourceVersion.Major))
++ (Paths.BuildOutput (sprintf "Elastic.Apm_%i.0.0/netstandard2.0" oldDiagnosticSourceVersion.Major))
|> Seq.filter Path.isDirectory
|> Seq.map DirectoryInfo
|> Seq.iter (copyDllsAndPdbs (agentDir.CreateSubdirectory(sprintf "%i.0.0" oldDiagnosticSourceVersion.Major)))
// assemblies compiled against 6.0 version of System.Diagnostics.DiagnosticSource
- !! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netcoreapp2.2" oldDiagnosticSourceVersion.Major)) //using old version here, because it the netcoreapp2.2 app can't build with diagnosticsource6
+ !! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netstandard2.0" oldDiagnosticSourceVersion.Major)) //using old version here, because it the netcoreapp2.2 app can't build with diagnosticsource6
++ (Paths.BuildOutput (sprintf "Elastic.Apm_%i.0.0/net6.0" diagnosticSourceVersion6.Major))
|> Seq.filter Path.isDirectory
|> Seq.map DirectoryInfo
diff --git a/src/startuphook/Elastic.Apm.StartupHook.Loader/Elastic.Apm.StartupHook.Loader.csproj b/src/startuphook/Elastic.Apm.StartupHook.Loader/Elastic.Apm.StartupHook.Loader.csproj
index 109cdb28d..19d9afedc 100644
--- a/src/startuphook/Elastic.Apm.StartupHook.Loader/Elastic.Apm.StartupHook.Loader.csproj
+++ b/src/startuphook/Elastic.Apm.StartupHook.Loader/Elastic.Apm.StartupHook.Loader.csproj
@@ -1,23 +1,25 @@
-
-
- netcoreapp2.2
- false
-
+
+ netstandard2.0
+ false
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ StartupHookLogger.cs
+
+
-
-
- StartupHookLogger.cs
-
-
-
diff --git a/src/startuphook/ElasticApmAgentStartupHook/ElasticApmAgentStartupHook.csproj b/src/startuphook/ElasticApmAgentStartupHook/ElasticApmAgentStartupHook.csproj
index 6ffb43834..5c79c06d5 100644
--- a/src/startuphook/ElasticApmAgentStartupHook/ElasticApmAgentStartupHook.csproj
+++ b/src/startuphook/ElasticApmAgentStartupHook/ElasticApmAgentStartupHook.csproj
@@ -1,9 +1,11 @@
-
- netcoreapp2.2
+ netstandard2.0
ElasticApmAgentStartupHook
false
ElasticApmStartupHook
+
+
+
diff --git a/src/startuphook/ElasticApmAgentStartupHook/StartupHookLogger.cs b/src/startuphook/ElasticApmAgentStartupHook/StartupHookLogger.cs
index 290b6e59d..7bbf532ef 100644
--- a/src/startuphook/ElasticApmAgentStartupHook/StartupHookLogger.cs
+++ b/src/startuphook/ElasticApmAgentStartupHook/StartupHookLogger.cs
@@ -46,19 +46,19 @@ public static StartupHookLogger Create()
public void WriteLine(string message)
{
- if (_enabled)
+ if (!_enabled)
+ return;
+
+ try
+ {
+ var log = $"[{DateTime.Now:u}] {message}";
+ Console.Out.WriteLine(log);
+ Console.Out.Flush();
+ File.AppendAllLines(_logPath, new[] { log });
+ }
+ catch
{
- try
- {
- var log = $"[{DateTime.Now:u}] {message}";
- Console.Out.WriteLine(log);
- Console.Out.Flush();
- File.AppendAllLines(_logPath, new[] { log });
- }
- catch
- {
- // if we can't log a log message, there's not much that can be done, so ignore
- }
+ // if we can't log a log message, there's not much that can be done, so ignore
}
}
}