From 9e500057b87d47c88815520ea146eddac66e7fc6 Mon Sep 17 00:00:00 2001 From: Arnaud Declercq Date: Tue, 24 Feb 2026 10:33:25 +0000 Subject: [PATCH 1/4] Upgrade project files to SDK-style format compatible with dotnet --- ExcelUI_Engine/ExcelUI_Engine.csproj | 58 ++----- ExcelUI_Engine/Properties/AssemblyInfo.cs | 65 ------- Excel_UI.sln | 6 +- Excel_UI/Excel_UI.csproj | 196 +++------------------- Excel_UI/Properties/AssemblyInfo.cs | 65 ------- Excel_UI/Properties/launchSettings.json | 9 + Excel_UI/packages.config | 8 - 7 files changed, 48 insertions(+), 359 deletions(-) delete mode 100644 ExcelUI_Engine/Properties/AssemblyInfo.cs delete mode 100644 Excel_UI/Properties/AssemblyInfo.cs create mode 100644 Excel_UI/Properties/launchSettings.json delete mode 100644 Excel_UI/packages.config diff --git a/ExcelUI_Engine/ExcelUI_Engine.csproj b/ExcelUI_Engine/ExcelUI_Engine.csproj index 313a4133..8df5d1c3 100644 --- a/ExcelUI_Engine/ExcelUI_Engine.csproj +++ b/ExcelUI_Engine/ExcelUI_Engine.csproj @@ -1,35 +1,19 @@ - - - + - Debug - AnyCPU - {56039ED6-FBD5-4F45-936B-2116399AEEC3} +net472 Library - Properties BH.Engine.Excel - ExcelUI_Engine - v4.7.2 - 512 - true - - - true - full - false - ..\Build\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true ..\Build\ - TRACE - prompt - 4 + ExcelUI_Engine + https://github.com/BHoM/Excel_UI + BHoM + Copyright © https://github.com/BHoM + 9.0.0.0 + 9.1.0.0 + + + $(ProgramData)\BHoM\Assemblies\BHoM.dll @@ -46,23 +30,7 @@ False False - - - - - - - - + + - - - - - - - - - xcopy "$(TargetPath)" "$(ProgramData)\BHoM\Assemblies" /Y - diff --git a/ExcelUI_Engine/Properties/AssemblyInfo.cs b/ExcelUI_Engine/Properties/AssemblyInfo.cs deleted file mode 100644 index c4916c97..00000000 --- a/ExcelUI_Engine/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2026, the respective contributors. All rights reserved. - * - * Each contributor holds copyright over their respective contributions. - * The project versioning (Git) records all such contribution source information. - * - * - * The BHoM is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3.0 of the License, or - * (at your option) any later version. - * - * The BHoM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this code. If not, see . - */ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ExcelUI_Engine")] -[assembly: AssemblyDescription("https://github.com/BHoM/Excel_UI")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("BHoM")] -[assembly: AssemblyCopyright("Copyright © https://github.com/BHoM")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("119988e5-0e23-4a5a-a2fa-c0336b2e68e9")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("9.0.0.0")] -[assembly: AssemblyFileVersion("9.1.0.0")] - - - - - - - diff --git a/Excel_UI.sln b/Excel_UI.sln index fedbcea7..79283802 100644 --- a/Excel_UI.sln +++ b/Excel_UI.sln @@ -1,11 +1,11 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.32126.317 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Excel_UI", "Excel_UI\Excel_UI.csproj", "{0FAF6FEB-80C3-474A-92BB-C886424CCBC8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Excel_UI", "Excel_UI\Excel_UI.csproj", "{0FAF6FEB-80C3-474A-92BB-C886424CCBC8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelUI_Engine", "ExcelUI_Engine\ExcelUI_Engine.csproj", "{56039ED6-FBD5-4F45-936B-2116399AEEC3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExcelUI_Engine", "ExcelUI_Engine\ExcelUI_Engine.csproj", "{56039ED6-FBD5-4F45-936B-2116399AEEC3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Excel_UI/Excel_UI.csproj b/Excel_UI/Excel_UI.csproj index fdafdab0..18a319da 100644 --- a/Excel_UI/Excel_UI.csproj +++ b/Excel_UI/Excel_UI.csproj @@ -1,37 +1,18 @@ - - - + - Debug - AnyCPU - {0FAF6FEB-80C3-474A-92BB-C886424CCBC8} +net472 Library - Properties BH.UI.Excel - Excel_UI - v4.7.2 - 512 - - - - - - true - full - false - ..\Build\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true + true + true + true ..\Build\ - TRACE - prompt - 4 + en-US + true + + + $(ProgramData)\BHoM\Assemblies\Adapter_Engine.dll @@ -68,25 +49,6 @@ $(ProgramData)\BHoM\Assemblies\Data_oM.dll False - - ..\packages\ExcelDna.Integration.1.5.1\lib\net452\ExcelDna.Integration.dll - - - ..\packages\ExcelDna.IntelliSense.1.1.0\lib\net40\ExcelDna.IntelliSense.dll - - - ..\packages\ExcelDna.Registration.0.34.7\lib\net40\ExcelDna.Registration.dll - - - ..\packages\Microsoft.Office.Interop.Excel.15.0.4795.1000\lib\net20\Microsoft.Office.Interop.Excel.dll - True - - - False - True - ..\libs\office.dll - - False $(ProgramData)\BHoM\Assemblies\Reflection_Engine.dll @@ -97,16 +59,6 @@ $(ProgramData)\BHoM\Assemblies\Serialiser_Engine.dll False - - - - - - - - - - False $(ProgramData)\BHoM\Assemblies\UI_Engine.dll @@ -122,134 +74,32 @@ $(ProgramData)\BHoM\Assemblies\Versioning_oM.dll False + + ..\libs\office.dll + False + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - {56039ed6-fbd5-4f45-936b-2116399aeec3} - ExcelUI_Engine - + - - - xcopy "$(TargetPath)" "$(ProgramData)\BHoM\Assemblies" /Y - -xcopy "$(TargetDir)*.xll" "$(ProgramData)\BHoM\Assemblies" /Y -xcopy "$(TargetDir)*.dna" "$(ProgramData)\BHoM\Assemblies" /Y -xcopy "$(TargetDir)ExcelDna.IntelliSense.dll" "$(ProgramData)\BHoM\Assemblies" /Y -xcopy "$(TargetDir)ExcelDna.Registration.dll" "$(ProgramData)\BHoM\Assemblies" /Y - -call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvarsall.bat" x86 -call "$(DevEnvDir)..\Tools\VsDevCmd.bat" -xcopy "$(ProjectDir)..\packages\ExcelDna.Integration.1.5.1\lib\net452\ExcelDna.Integration.dll" "$(ProgramData)\BHoM\Assemblies" /Y -tlbexp.exe "$(ProgramData)\BHoM\Assemblies\$(TargetName)$(TargetExt)" /out:"$(ProgramData)\BHoM\Assemblies\$(TargetName).tlb" -del "$(ProgramData)\BHoM\Assemblies\ExcelDna.Integration.dll" - - Program C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE - false - - - en-US C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE Program - false - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - diff --git a/Excel_UI/Properties/AssemblyInfo.cs b/Excel_UI/Properties/AssemblyInfo.cs deleted file mode 100644 index 9195fb7b..00000000 --- a/Excel_UI/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2026, the respective contributors. All rights reserved. - * - * Each contributor holds copyright over their respective contributions. - * The project versioning (Git) records all such contribution source information. - * - * - * The BHoM is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3.0 of the License, or - * (at your option) any later version. - * - * The BHoM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this code. If not, see . - */ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Excel_UI")] -[assembly: AssemblyDescription("https://github.com/BHoM/Excel_UI")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("BHoM")] -[assembly: AssemblyCopyright("Copyright © https://github.com/BHoM")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0faf6feb-80c3-474a-92bb-c886424ccbc8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("9.0.0.0")] -[assembly: AssemblyFileVersion("9.1.0.0")] - - - - - - - diff --git a/Excel_UI/Properties/launchSettings.json b/Excel_UI/Properties/launchSettings.json new file mode 100644 index 00000000..fd6dca43 --- /dev/null +++ b/Excel_UI/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "Excel": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE", + "commandLineArgs": "/x \"BHoM-AddIn64.xll\"" + } + } +} \ No newline at end of file diff --git a/Excel_UI/packages.config b/Excel_UI/packages.config deleted file mode 100644 index e5232f55..00000000 --- a/Excel_UI/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 2dbcc320e30756c3fddc98b6664f2f8b37b29dd1 Mon Sep 17 00:00:00 2001 From: Arnaud Declercq Date: Tue, 24 Feb 2026 10:33:44 +0000 Subject: [PATCH 2/4] Fix compilation cause by missing explicit casting --- Excel_UI/Addin/AddIn_BackwardCompatibility.cs | 6 ++--- Excel_UI/Addin/AddIn_Formulas.cs | 22 +++++++++---------- Excel_UI/Addin/AddIn_Internalise.cs | 4 ++-- Excel_UI/Addin/AddIn_Workbook.cs | 6 ++--- Excel_UI/Templates/CallerValueListFormula.cs | 6 ++--- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Excel_UI/Addin/AddIn_BackwardCompatibility.cs b/Excel_UI/Addin/AddIn_BackwardCompatibility.cs index 5eae71a2..6d433694 100644 --- a/Excel_UI/Addin/AddIn_BackwardCompatibility.cs +++ b/Excel_UI/Addin/AddIn_BackwardCompatibility.cs @@ -77,15 +77,15 @@ private static List> Old_GetFormulas() string callerType = ""; try { - Range cell = row.Cells[1, 2]; + Range cell = (Range)row.Cells[1, 2]; callerType = cell.Value.ToString(); int col = 3; - cell = row.Cells[1, col++]; + cell = (Range)row.Cells[1, col++]; while (cell.Value != null && cell.Value is string && (cell.Value as string).Length > 0) { str += cell.Value; - cell = row.Cells[1, col++]; + cell = (Range)row.Cells[1, col++]; } } catch { } diff --git a/Excel_UI/Addin/AddIn_Formulas.cs b/Excel_UI/Addin/AddIn_Formulas.cs index 56f63bd3..a36cafe3 100644 --- a/Excel_UI/Addin/AddIn_Formulas.cs +++ b/Excel_UI/Addin/AddIn_Formulas.cs @@ -104,9 +104,9 @@ public static void RestoreFormulas() for (int i = 2; i < 10000; i++) { // Recover the information about the formula - string formulaName = sheet.Cells[i, 1].Value as string; - string callerJson = sheet.Cells[i, 2].Value as string; - string oldFunction = sheet.Cells[i, 3].Value as string; + string formulaName = ((Range)sheet.Cells[i, 1]).Value as string; + string callerJson = ((Range)sheet.Cells[i, 2]).Value as string; + string oldFunction = ((Range)sheet.Cells[i, 3]).Value as string; if (formulaName == null || formulaName.Length == 0 || callerJson == null || callerJson.Length == 0) break; @@ -169,13 +169,13 @@ private static void UpdateEnumValues(string collectionName) { try { - string name = choicesSheet.Cells[i, 1].Value as string; + string name = ((Range)choicesSheet.Cells[i, 1]).Value as string; if (string.IsNullOrEmpty(name)) { // Need to add the choices here - this should not be needed on loading a sheet, but as a safety net - choicesSheet.Cells[i, 1].Value = collectionName; + ((Range)choicesSheet.Cells[i, 1]).Value = collectionName; for (int j = 0; j < enumChoices.Length; j++) - choicesSheet.Cells[i, j + 2].Value = enumChoices.GetValue(j).ToString(); + ((Range)choicesSheet.Cells[i, j + 2]).Value = enumChoices.GetValue(j).ToString(); break; } else @@ -247,11 +247,11 @@ private static void SaveCallerToHiddenSheet(CallerFormula caller) lock(m_Mutex) { // Get teh sheet ID - string sheetId = sheet.Cells[1, 1].Value as string; + string sheetId = ((Range)sheet.Cells[1, 1]).Value as string; if (sheetId == null) { sheetId = ToString(Guid.NewGuid()); - sheet.Cells[1, 1].Value = sheetId; + ((Range)sheet.Cells[1, 1]).Value = sheetId; } // Make sure there is a list of saved callers for this worksheet @@ -264,9 +264,9 @@ private static void SaveCallerToHiddenSheet(CallerFormula caller) m_SavedOnWorkbook[sheetId].Add(caller.Function); int row = m_SavedOnWorkbook[sheetId].Count + 1; - sheet.Cells[row, 1].Value = caller.Caller.GetType().Name; - sheet.Cells[row, 2].Value = caller.Caller.Write(); - sheet.Cells[row, 3].Value = caller.Function; + ((Range)sheet.Cells[row, 1]).Value = caller.Caller.GetType().Name; + ((Range)sheet.Cells[row, 2]).Value = caller.Caller.Write(); + ((Range)sheet.Cells[row, 3]).Value = caller.Function; } } }); diff --git a/Excel_UI/Addin/AddIn_Internalise.cs b/Excel_UI/Addin/AddIn_Internalise.cs index fbef01d0..ee149ef7 100644 --- a/Excel_UI/Addin/AddIn_Internalise.cs +++ b/Excel_UI/Addin/AddIn_Internalise.cs @@ -107,7 +107,7 @@ private static void WriteJsonToSheet(string sheetName, Dictionary ReadJsonFromSheet(string sheetName) { try { - string segment = sheet.Cells[i, 1].Value as string; + string segment = ((Range)sheet.Cells[i, 1]).Value as string; if (string.IsNullOrEmpty(segment)) break; else diff --git a/Excel_UI/Addin/AddIn_Workbook.cs b/Excel_UI/Addin/AddIn_Workbook.cs index 19605a8b..299a808b 100644 --- a/Excel_UI/Addin/AddIn_Workbook.cs +++ b/Excel_UI/Addin/AddIn_Workbook.cs @@ -66,12 +66,12 @@ public static Worksheet Sheet(string name, bool addIfMissing = true, bool isHidd // Look for the sheet in the active workbook Worksheet sheet = null; if (workbook.Sheets.OfType().Any(x => x.Name == name)) - sheet = workbook.Sheets[name]; + sheet = (Worksheet)workbook.Sheets[name]; // If sheet doesn't exist, create it if requested if (sheet == null && addIfMissing) { - sheet = workbook.Sheets.Add(); + sheet = (Worksheet)workbook.Sheets.Add(); sheet.Name = name; if (isHidden) @@ -155,7 +155,7 @@ public static string WorkbookId(Workbook workbook = null) if (workbook == null) return null; - DocumentProperties properties = workbook.CustomDocumentProperties; + DocumentProperties properties = (DocumentProperties)workbook.CustomDocumentProperties; foreach (DocumentProperty prop in properties) { if (prop.Name == "BHoM_Guid") diff --git a/Excel_UI/Templates/CallerValueListFormula.cs b/Excel_UI/Templates/CallerValueListFormula.cs index 31a3b16a..e837b9e4 100644 --- a/Excel_UI/Templates/CallerValueListFormula.cs +++ b/Excel_UI/Templates/CallerValueListFormula.cs @@ -137,13 +137,13 @@ protected string GetChoicesFormula(string collectionName, List choices) { try { - string name = sheet.Cells[i,1].Value as string; + string name = ((Range)sheet.Cells[i,1]).Value as string; if (string.IsNullOrEmpty(name)) { // Need to add the choices here - sheet.Cells[i, 1].Value = collectionName; + ((Range)sheet.Cells[i, 1]).Value = collectionName; for (int j = 0; j < choices.Count; j++) - sheet.Cells[i, j + 2].Value = choices[j]; + ((Range)sheet.Cells[i, j + 2]).Value = choices[j]; break; } else if (collectionName == name) From 4b26f53e479834e8af056c55dd990bd1070f0bd4 Mon Sep 17 00:00:00 2001 From: Arnaud Declercq Date: Tue, 24 Feb 2026 10:39:46 +0000 Subject: [PATCH 3/4] Fixing project compliance --- Excel_UI/Excel_UI.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Excel_UI/Excel_UI.csproj b/Excel_UI/Excel_UI.csproj index 18a319da..6e731c41 100644 --- a/Excel_UI/Excel_UI.csproj +++ b/Excel_UI/Excel_UI.csproj @@ -9,6 +9,10 @@ ..\Build\ en-US true + https://github.com/BHoM/Excel_UI + Copyright © https://github.com/BHoM + 9.0.0.0 + 9.1.0.0 From 7241e0c3e8759e3edbe744e75d10e2369db2e3c2 Mon Sep 17 00:00:00 2001 From: Arnaud Declercq Date: Tue, 24 Feb 2026 12:03:29 +0000 Subject: [PATCH 4/4] Make sure the compilation output is written directly in the Build folder --- ExcelUI_Engine/ExcelUI_Engine.csproj | 3 ++- Excel_UI/Excel_UI.csproj | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ExcelUI_Engine/ExcelUI_Engine.csproj b/ExcelUI_Engine/ExcelUI_Engine.csproj index 8df5d1c3..ad709eeb 100644 --- a/ExcelUI_Engine/ExcelUI_Engine.csproj +++ b/ExcelUI_Engine/ExcelUI_Engine.csproj @@ -4,10 +4,11 @@ Library BH.Engine.Excel ..\Build\ + false ExcelUI_Engine https://github.com/BHoM/Excel_UI BHoM - Copyright © https://github.com/BHoM + Copyright � https://github.com/BHoM 9.0.0.0 9.1.0.0 diff --git a/Excel_UI/Excel_UI.csproj b/Excel_UI/Excel_UI.csproj index 6e731c41..6eacb90a 100644 --- a/Excel_UI/Excel_UI.csproj +++ b/Excel_UI/Excel_UI.csproj @@ -7,6 +7,7 @@ true true ..\Build\ + false en-US true https://github.com/BHoM/Excel_UI