Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2dc3521
Initial plan
Copilot Sep 22, 2025
53b5adc
Migrate FwUtils to SDK-style csproj format
Copilot Sep 22, 2025
6ccb518
Migrate Filters to SDK-style csproj format
Copilot Sep 22, 2025
edf37a8
Fix build issues with generated files
Copilot Sep 22, 2025
f592d4b
Update build task to support SDK-style projects
Copilot Sep 22, 2025
586ba53
Fix trailing whitespace in CollectTargets.cs
Copilot Sep 22, 2025
2e57438
Fix duplicate Compile items in FwUtils.csproj
Copilot Sep 22, 2025
f2987e7
Fix NuGet restore for SDK projects
Copilot Sep 22, 2025
5ed0358
Add dotnet restore for SDK projects
Copilot Sep 22, 2025
26d8af8
Disable deterministic builds for SDK projects
Copilot Sep 22, 2025
cdda223
Fix assembly version conflicts by using local refs
Copilot Sep 22, 2025
ba1a401
Correctly classify packages vs local assemblies
Copilot Sep 22, 2025
da01a66
Add missing SIL.Lexicon PackageReference
Copilot Sep 22, 2025
fa6d0ab
Revert to assembly refs to fix version conflicts
Copilot Sep 23, 2025
edf260c
Final cleanup of assembly references
Copilot Sep 23, 2025
632563b
Complete SDK-style migration with assembly refs
Copilot Sep 23, 2025
efe4e1b
Convert to PackageReferences to fix tests
Copilot Sep 23, 2025
9b9fa64
Addressing PR comments
Copilot Sep 23, 2025
d351ca9
Merge branch 'release/9.3' into copilot/fix-bb2a324b-436b-47cf-a3fb-4…
jasonleenaylor Sep 23, 2025
129e00d
Fix SIL.Lexicon version conflict
jasonleenaylor Sep 23, 2025
1cc43d6
Make converted projects target windows to allow System.Drawing use
jasonleenaylor Sep 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Build/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<!-- Download packages in packages-common.config. Then download packages in packages-windows.config. -->
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="$(RestoreCommandCommon)"/>
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="$(RestoreCommandPlatformSpecific)"/>
<!-- Run dotnet restore for SDK-style projects to generate project.assets.json -->
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="dotnet restore &quot;$(fwrt)/Src/Common/FwUtils/FwUtils.csproj&quot;" ContinueOnError="true" />
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="dotnet restore &quot;$(fwrt)/Src/Common/Filters/Filters.csproj&quot;" ContinueOnError="true" />
</Target>

<PropertyGroup>
Expand Down
75 changes: 63 additions & 12 deletions Build/Src/FwBuildTasks/CollectTargets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public StopTaskException(Exception innerException) : base(null, innerException)
private TaskLoggingHelper Log { get; }
private XmlDocument m_csprojFile;
private XmlNamespaceManager m_namespaceMgr;
private bool m_isSdkStyle;
private Dictionary<string, int> m_timeoutMap;
private string ToolsVersion { get; set; }

Expand Down Expand Up @@ -193,7 +194,20 @@ private void LoadProjectFile(string projectFile)
m_csprojFile = new XmlDocument();
m_csprojFile.Load(projectFile);
m_namespaceMgr = new XmlNamespaceManager(m_csprojFile.NameTable);
m_namespaceMgr.AddNamespace("c", "http://schemas.microsoft.com/developer/msbuild/2003");

// Check if this is an SDK-style project
var root = m_csprojFile.DocumentElement;
if (root.HasAttribute("Sdk"))
{
// SDK-style project - no explicit namespace needed for XPath
m_isSdkStyle = true;
}
else
{
// Old-style project with explicit namespace
m_namespaceMgr.AddNamespace("c", "http://schemas.microsoft.com/developer/msbuild/2003");
m_isSdkStyle = false;
}
}
catch (XmlException e)
{
Expand All @@ -212,14 +226,26 @@ private string AssemblyName
{
get
{
var name = m_csprojFile.SelectSingleNode("/c:Project/c:PropertyGroup/c:AssemblyName",
m_namespaceMgr);
var type = m_csprojFile.SelectSingleNode("/c:Project/c:PropertyGroup/c:OutputType",
m_namespaceMgr);
XmlNode name, type;

if (m_isSdkStyle)
{
// SDK-style project - no namespace prefix needed
name = m_csprojFile.SelectSingleNode("/Project/PropertyGroup/AssemblyName");
type = m_csprojFile.SelectSingleNode("/Project/PropertyGroup/OutputType");
}
else
{
// Old-style project with namespace
name = m_csprojFile.SelectSingleNode("/c:Project/c:PropertyGroup/c:AssemblyName", m_namespaceMgr);
type = m_csprojFile.SelectSingleNode("/c:Project/c:PropertyGroup/c:OutputType", m_namespaceMgr);
}

string extension = ".dll";
if (type.InnerText == "WinExe" || type.InnerText == "Exe")
if (type != null && (type.InnerText == "WinExe" || type.InnerText == "Exe"))
extension = ".exe";
return name.InnerText + extension;

return name?.InnerText + extension;
}
}

Expand All @@ -230,9 +256,34 @@ private XmlNodeList ConfigNodes
{
get
{
return m_csprojFile.SelectNodes("/c:Project/c:PropertyGroup[c:DefineConstants]",
m_namespaceMgr);
if (m_isSdkStyle)
{
// SDK-style project - no namespace prefix needed
return m_csprojFile.SelectNodes("/Project/PropertyGroup[DefineConstants]");
}
else
{
// Old-style project with namespace
return m_csprojFile.SelectNodes("/c:Project/c:PropertyGroup[c:DefineConstants]", m_namespaceMgr);
}
}
}

/// <summary>
/// Helper method to get DefineConstants from a PropertyGroup node for both old and SDK-style projects
/// </summary>
private string GetDefineConstants(XmlNode node)
{
XmlNode defineNode;
if (m_isSdkStyle)
{
defineNode = node.SelectSingleNode("DefineConstants");
}
else
{
defineNode = node.SelectSingleNode("c:DefineConstants", m_namespaceMgr);
}
return defineNode?.InnerText?.Replace(";", " ") ?? "";
}

private string GetProjectSubDir(string project)
Expand Down Expand Up @@ -308,14 +359,14 @@ private void WriteTargetFiles()
// for multiple platforms, e.g. for AnyCpu and x64.
if (configs.ContainsKey(configuration))
{
if (configs[configuration] != node.SelectSingleNode("c:DefineConstants", m_namespaceMgr).InnerText.Replace(";", " "))
if (configs[configuration] != GetDefineConstants(node))
{
Log.LogError("Configuration {0} for project {1} is defined several times " +
"but contains differing values for DefineConstants.", configuration, project);
}
continue;
}
configs.Add(configuration, node.SelectSingleNode("c:DefineConstants", m_namespaceMgr).InnerText.Replace(";", " "));
configs.Add(configuration, GetDefineConstants(node));

writer.WriteLine("\t\t<When Condition=\" '$(config-capital)' == '{0}' \">", configuration);
writer.WriteLine("\t\t\t<PropertyGroup>");
Expand All @@ -328,7 +379,7 @@ private void WriteTargetFiles()
otherwiseBldr.AppendLine("\t\t<Otherwise>");
otherwiseBldr.AppendLine("\t\t\t<PropertyGroup>");
otherwiseBldr.AppendLine(string.Format("\t\t\t\t<{0}Defines>{1} CODE_ANALYSIS</{0}Defines>", project,
node.SelectSingleNode("c:DefineConstants", m_namespaceMgr).InnerText.Replace(";", " ")));
GetDefineConstants(node)));
otherwiseBldr.AppendLine("\t\t\t</PropertyGroup>");
otherwiseBldr.AppendLine("\t\t</Otherwise>");
otherwiseAdded = true;
Expand Down
Loading
Loading