diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs
index 6daa71996c..a381c8c995 100755
--- a/Prebuild/src/Core/Targets/VSGenericTarget.cs
+++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs
@@ -574,66 +574,6 @@ namespace Prebuild.Core.Targets
#endregion
}
- private void WriteProjectDotNet(SolutionNode solution, ProjectNode project, StreamWriter ps)
- {
- #region Project File
- using (ps)
- {
- ps.WriteLine("");
- ps.WriteLine();
-
- ps.WriteLine(" ");
- ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", "."));
- ps.WriteLine(" {0}", project.Name);
- ps.WriteLine(" ");
- ps.WriteLine();
-
- // For .NET5/6 files, the Configuration section does not specify a build target
- // so here we look for the "unknown" target type for the specified parameters.
- foreach (ConfigurationNode conf in project.Configurations)
- {
- if (conf.Name == "unknown")
- {
- ps.WriteLine(" ");
- foreach (string opt in conf.Options.AllDefined())
- {
- ps.WriteLine(" <{0}>{1}{0}>", opt,
- Helper.EndPath(Helper.NormalizePath(conf.Options[opt].ToString())));
- }
- ps.WriteLine(" ");
- ps.WriteLine();
- }
- }
-
- if (project.ProjectReferences.Count > 0)
- {
- ps.WriteLine(" ");
- foreach (ProjectReferenceNode refer in project.ProjectReferences)
- {
- ps.WriteLine(" ", refer.Include);
- }
- ps.WriteLine(" ");
- ps.WriteLine();
- }
- if (project.PackageReferences.Count > 0)
- {
- ps.WriteLine(" ");
- foreach (PackageReferenceNode pack in project.PackageReferences)
- {
- ps.WriteLine(" ",
- pack.Name, pack.Version);
- }
- ps.WriteLine(" ");
- ps.WriteLine();
- }
- // Output the ItemGroup for project.References
- WriteProjectReferences(solution, project, ps);
-
- ps.WriteLine("");
- }
- #endregion
- }
-
private void WriteProjectReferences(SolutionNode solution, ProjectNode project, StreamWriter ps)
{
Dictionary projectReferences = new Dictionary();
@@ -722,6 +662,179 @@ namespace Prebuild.Core.Targets
}
}
+ private void WriteProjectDotNet(SolutionNode solution, ProjectNode project, StreamWriter ps)
+ {
+ #region Project File
+ using (ps)
+ {
+ ps.WriteLine("");
+ ps.WriteLine();
+
+ ps.WriteLine(" ");
+ ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", "."));
+ ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
+ ps.WriteLine(" false");
+ ps.WriteLine(" 5.0.0");
+ ps.WriteLine(" disable");
+ ps.WriteLine(" {0}", project.AssemblyName);
+ ps.WriteLine(" true");
+ ps.WriteLine(" ");
+ ps.WriteLine();
+
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ if (conf.Name == "unknown")
+ {
+ ps.WriteLine(" ");
+ foreach (string opt in conf.Options.AllDefined())
+ {
+ ps.WriteLine(" <{0}>{1}{0}>", opt,
+ Helper.EndPath(Helper.NormalizePath(conf.Options[opt].ToString())));
+ }
+ ps.WriteLine(" ");
+ ps.WriteLine();
+ }
+ else
+ {
+ ps.Write(" ", conf.Name, conf.Platform);
+ ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]);
+ ps.WriteLine(" {0}", conf.Options["BaseAddress"]);
+ if ((bool)conf.Options["CheckUnderflowOverflow"])
+ ps.WriteLine(" True");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" {0}",
+ conf.Options["CompilerDefines"].ToString() == "" ? this.kernel.ForcedConditionals : conf.Options["CompilerDefines"] + ";" + kernel.ForcedConditionals);
+ ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
+ ps.WriteLine(" {0}", conf.Options["DebugInformation"]);
+ ps.WriteLine(" {0}", conf.Options["FileAlignment"]);
+ ps.WriteLine(" {0}", conf.Options["OptimizeCode"]);
+ if (project.Type != ProjectType.Web)
+ ps.WriteLine(" {0}",
+ Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
+ else
+ ps.WriteLine(" {0}",
+ Helper.EndPath(Helper.NormalizePath("bin\\")));
+
+ ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]);
+ ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]);
+ ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]);
+ ps.WriteLine(" {0}", conf.Options["WarningLevel"]);
+ ps.WriteLine(" {0}", conf.Options["NoStdLib"]);
+ ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]);
+ ps.WriteLine(" {0}", conf.Platform);
+ ps.WriteLine(" ");
+ }
+ }
+
+ if (project.ProjectReferences.Count > 0)
+ {
+ ps.WriteLine(" ");
+ foreach (ProjectReferenceNode refer in project.ProjectReferences)
+ {
+ ps.WriteLine(" ", refer.Include);
+ }
+ ps.WriteLine(" ");
+ ps.WriteLine();
+ }
+ if (project.PackageReferences.Count > 0)
+ {
+ ps.WriteLine(" ");
+ foreach (PackageReferenceNode pack in project.PackageReferences)
+ {
+ ps.WriteLine(" ",
+ pack.Name, pack.Version);
+ }
+ ps.WriteLine(" ");
+ ps.WriteLine();
+ }
+ // Output the ItemGroup for project.References
+ WriteProjectReferencesDotNet(solution, project, ps);
+
+ ps.WriteLine("");
+ }
+ #endregion
+ }
+
+ private void WriteProjectReferencesDotNet(SolutionNode solution, ProjectNode project, StreamWriter ps)
+ {
+ Dictionary projectReferences = new Dictionary();
+ List otherReferences = new List();
+
+ foreach (ReferenceNode refr in project.References)
+ {
+ ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
+
+ if (projectNode == null)
+ otherReferences.Add(refr);
+ else
+ projectReferences.Add(refr, projectNode);
+ }
+ // Assembly References
+ if (otherReferences.Count > 0)
+ {
+ ps.WriteLine(" ");
+
+ foreach (ReferenceNode refr in otherReferences)
+ {
+ ps.Write(" ");
+ ps.Write(" ");
+ ps.Write(refr.Name);
+ ps.WriteLine("");
+
+ if (!String.IsNullOrEmpty(refr.Path))
+ {
+ // Use absolute path to assembly (for determining assembly type)
+ string absolutePath = Path.Combine(project.FullPath, refr.Path);
+ if (File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe")))
+ {
+ // Assembly is an executable (exe)
+ ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
+ }
+ else if (File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll")))
+ {
+ // Assembly is an library (dll)
+ ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
+ }
+ else
+ {
+ string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
+ kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
+ ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
+ }
+ }
+
+ ps.WriteLine(" {0}", refr.LocalCopy);
+ ps.WriteLine(" ");
+ }
+ ps.WriteLine(" ");
+ ps.WriteLine();
+ }
+
+ //Project References
+ if (projectReferences.Count > 0)
+ {
+ ps.WriteLine(" ");
+ foreach (KeyValuePair pair in projectReferences)
+ {
+ ToolInfo tool = tools[pair.Value.Language];
+ if (tools == null)
+ throw new UnknownLanguageException();
+
+ string path =
+ Helper.MakePathRelativeTo(project.FullPath,
+ Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
+ ps.WriteLine(" ", path);
+ }
+ ps.WriteLine(" ");
+ ps.WriteLine();
+ }
+ }
+
private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
{
kernel.Log.Write("Creating {0} solution and project files", VersionName);