From cecaa0de3a27aa5d35f84547c4968a46f1238241 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 21 May 2024 08:50:31 +0200 Subject: [PATCH] C#: Clear possibly inherited Directory.Build.props and Directory.Build.targets in stub generator --- csharp/scripts/stubs/helpers.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/csharp/scripts/stubs/helpers.py b/csharp/scripts/stubs/helpers.py index ce663bac4e8..33b8f2663f8 100644 --- a/csharp/scripts/stubs/helpers.py +++ b/csharp/scripts/stubs/helpers.py @@ -77,6 +77,14 @@ class Generator: self.projectNameIn, '--output', self.projectDirIn]) remove_files(self.projectDirIn, '.cs') + # Clear possibly inherited Directory.Build.props and Directory.Build.targets: + with open(os.path.join(self.workDir, 'Directory.Build.props'), 'w') as f: + f.write('\n') + f.write('\n') + with open(os.path.join(self.workDir, 'Directory.Build.targets'), 'w') as f: + f.write('\n') + f.write('\n') + def run_cmd(self, cmd, msg="Failed to run command"): run_cmd_cwd(cmd, self.workDir, msg)