Output: Create Visual Studio .csproj files when using --project (Project References are not currently resolved)
This commit is contained in:
@@ -102,7 +102,7 @@ namespace Il2CppInspector
|
||||
}
|
||||
|
||||
// Create a Visual Studio solution
|
||||
public void WriteSolution(string outPath) {
|
||||
public void WriteSolution(string outPath, string unityPath, string unityAssembliesPath) {
|
||||
// Required settings
|
||||
MustCompile = true;
|
||||
|
||||
@@ -116,10 +116,12 @@ namespace Il2CppInspector
|
||||
foreach (var asm in assemblies) {
|
||||
var guid = Guid.NewGuid();
|
||||
var name = asm.ShortName.Replace(".dll", "");
|
||||
var csProjFile = $"{name}\\{name}.csproj";
|
||||
|
||||
var def = Resources.SlnProjectDefinition
|
||||
.Replace("%PROJECTGUID%", guid.ToString())
|
||||
.Replace("%PROJECTNAME%", name)
|
||||
.Replace("%CSPROJRELATIVEPATH%", $"{name}\\{name}.csproj");
|
||||
.Replace("%CSPROJRELATIVEPATH%", csProjFile);
|
||||
|
||||
slnProjectDefs.Append(def);
|
||||
|
||||
@@ -127,6 +129,15 @@ namespace Il2CppInspector
|
||||
.Replace("%PROJECTGUID%", guid.ToString());
|
||||
|
||||
slnProjectConfigs.Append(config);
|
||||
|
||||
// Create a .csproj file using the project Guid
|
||||
var csProj = Resources.CsProjTemplate
|
||||
.Replace("%PROJECTGUID%", guid.ToString())
|
||||
.Replace("%ASSEMBLYNAME%", name)
|
||||
.Replace("%UNITYPATH%", unityPath)
|
||||
.Replace("%SCRIPTASSEMBLIES%", unityAssembliesPath);
|
||||
|
||||
File.WriteAllText($"{outPath}\\{csProjFile}", csProj);
|
||||
}
|
||||
|
||||
// Merge everything into .sln file
|
||||
|
||||
@@ -108,9 +108,12 @@ namespace Il2CppInspector
|
||||
}
|
||||
|
||||
// Creating a Visual Studio solution requires Unity assembly references
|
||||
var unityPath = string.Empty;
|
||||
var unityAssembliesPath = string.Empty;
|
||||
|
||||
if (options.CreateSolution) {
|
||||
var unityPath = FindPath(options.UnityPath);
|
||||
var unityAssembliesPath = FindPath(options.UnityAssembliesPath);
|
||||
unityPath = FindPath(options.UnityPath);
|
||||
unityAssembliesPath = FindPath(options.UnityAssembliesPath);
|
||||
|
||||
if (!Directory.Exists(unityPath)) {
|
||||
Console.Error.WriteLine($"Unity path {unityPath} does not exist");
|
||||
@@ -167,7 +170,7 @@ namespace Il2CppInspector
|
||||
csOut += imageSuffix;
|
||||
|
||||
if (options.CreateSolution) {
|
||||
writer.WriteSolution(csOut);
|
||||
writer.WriteSolution(csOut, unityPath, unityAssembliesPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>%PROJECTGUID%</ProjectGuid>
|
||||
<ProjectGuid>{%PROJECTGUID%}</ProjectGuid>
|
||||
<!--<ProductVersion/>-->
|
||||
<!--<SchemaVersion/>-->
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
Reference in New Issue
Block a user