From 2722074ed324d567894d5b5a361de0e1bff20e8b Mon Sep 17 00:00:00 2001 From: Recolic K <bensl@microsoft.com> Date: Sat, 8 May 2021 16:37:19 +0800 Subject: [PATCH] fix another csproj error in controlplane --- main.go | 2 +- tools/csproj-to-5/main.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 33d65ac..8dfa7b5 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( // Some options here. Would be improved in beta release. const DEDUCT_PKGNAME_FROM_VARNAME = true const USE_PROJECT_NETVER_INSTEAD_OF_HINTPATH_NETVER = false -const OPENXT_VERSION = "1.2-2" +const OPENXT_VERSION = "1.2-3" func print_help_and_exit() { println("Usage: openxt <subcommand> [options...]") diff --git a/tools/csproj-to-5/main.go b/tools/csproj-to-5/main.go index ce50f0a..0718bc6 100644 --- a/tools/csproj-to-5/main.go +++ b/tools/csproj-to-5/main.go @@ -130,6 +130,11 @@ func main() { resultTxt += line + "\n" } + // patch: if the csproj has no <TargetFramework> and <TargetFrameworkVersion> at all, we must fix this error with a default targetFramework. + if ! (stringContainsInsensitive(resultTxt, "<TargetFramework>") || stringContainsInsensitive(resultTxt, "<TargetFrameworkVersion>")) { + stringReplaceOnceInsensitive(resultTxt, "<PropertyGroup>", "<PropertyGroup><TargetFramework>net472</TargetFramework><GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>") + } + err = ioutil.WriteFile(fname, []byte(resultTxt), 0644) panicErrorIfAny(err, "WriteFile " + fname) } -- GitLab