MCPcopy Create free account
hub / github.com/antopilo/Nuake / GenerateSolution

Method GenerateSolution

Nuake/Source/Nuake/Scripting/ScriptingEngineNet.cpp:778–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

776 }
777
778 void ScriptingEngineNet::GenerateSolution(const std::string& path, const std::string& projectName)
779 {
780 CopyNuakeNETAssemblies(path);
781
782 const std::string cleanProjectName = String::Sanitize(projectName);
783 const std::string csprojFilePath = cleanProjectName + ".csproj";
784 const std::string& csProjFileContent = R"(<?xml version="1.0" encoding="utf-8"?>
785<Project Sdk="Microsoft.NET.Sdk">
786 <PropertyGroup>
787 <TargetFramework>net8.0</TargetFramework>
788 <OutputType>Library</OutputType>
789 <LangVersion>latest</LangVersion>
790 </PropertyGroup>
791 <ItemGroup>
792 <Reference Include="NuakeNet">
793 <HintPath>NuakeNet.dll</HintPath>
794 </Reference>
795 </ItemGroup>
796</Project>
797)";
798 FileSystem::BeginWriteFile(csprojFilePath);
799 FileSystem::WriteLine(csProjFileContent);
800 FileSystem::EndWriteFile();
801
802 const std::string slnFilePath = cleanProjectName + ".sln";
803 const std::string guid = GenerateGUID(); // Generate GUID
804
805 const std::string& slnFileContent = R"(Microsoft Visual Studio Solution File, Format Version 12.00
806# Visual Studio Version 17
807VisualStudioVersion = 17.0.32327.299
808MinimumVisualStudioVersion = 10.0.40219.1
809Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = ")" + cleanProjectName + R"(", ")" + cleanProjectName + R"(.csproj", ")" + guid + R"("
810 EndProject
811Global
812 GlobalSection(SolutionConfigurationPlatforms) = preSolution
813 Debug|Any CPU = Debug|Any CPU
814 Release|Any CPU = Release|Any CPU
815 EndGlobalSection
816 GlobalSection(ProjectConfigurationPlatforms) = postSolution
817 {)" + guid + R"(}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
818 {)" + guid + R"(}.Debug|Any CPU.Build.0 = Debug|Any CPU
819 {)" + guid + R"(}.Release|Any CPU.ActiveCfg = Release|Any CPU
820 {)" + guid + R"(}.Release|Any CPU.Build.0 = Release|Any CPU
821 EndGlobalSection
822 GlobalSection(SolutionProperties) = preSolution
823 HideSolutionNode = FALSE
824 EndGlobalSection
825EndGlobal
826)";
827 FileSystem::BeginWriteFile(slnFilePath);
828 FileSystem::WriteLine(slnFileContent);
829 FileSystem::EndWriteFile();
830
831 // Open solution file in visual studio
832 OS::OpenIn(path + cleanProjectName + ".sln");
833
834 // Delete premake script
835 FileSystem::DeleteFileFromPath(FileSystem::Root + "/premake5.lua");

Callers 1

DrawMenuBarMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected