def _addstaticmsbuildproperty(self, projectfile: str): 'Insert static msbuild property in the specified project file' if self.msbuildstatic: for propertyarg in self.msbuildstatic.split(';'): propertyname, propertyvalue = propertyarg.split('=') propertystring = f'\n <PropertyGroup>\n <{propertyname}>{propertyvalue}</{propertyname}>\n </PropertyGroup>' insert_after(projectfile, r'</PropertyGroup>', propertystring)
def add_event_source(self, file: str, line: str, trace_statement: str): ''' Adds a copy of the event source to the project and inserts the correct call file: relative path to the root of the project (where the project file lives) line: Exact line to insert trace statement after trace_statement: Statement to insert ''' projpath = os.path.dirname(self.project.csproj_file) staticpath = os.path.join(get_repo_root_path(), "src", "scenarios", "staticdeps") if helixpayload(): staticpath = os.path.join(helixpayload(), "staticdeps") shutil.copyfile(os.path.join(staticpath, "PerfLab.cs"), os.path.join(projpath, "PerfLab.cs")) filepath = os.path.join(projpath, file) insert_after(filepath, line, trace_statement)