diff --git a/templates/build/Program.cs b/templates/build/Program.cs index 268619b6d..e67467e62 100644 --- a/templates/build/Program.cs +++ b/templates/build/Program.cs @@ -82,10 +82,10 @@ void CopyFile(DirectoryInfo directoryInfo, FileInfo fileInfo) bool TryFindFile(string fileName, [NotNullWhen(true)] out FileInfo? found) { + var executingAssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + ?? throw new InvalidOperationException("Failed to find executing assembly location"); - - var currentDir = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) - ?? throw new InvalidOperationException("Failed to find directory for current assembly")); + var currentDir = new DirectoryInfo(executingAssemblyLocation); while (currentDir != null && currentDir.Exists) { diff --git a/templates/build/build.csproj b/templates/build/build.csproj index fd4bd08da..ed9781c22 100644 --- a/templates/build/build.csproj +++ b/templates/build/build.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable