netcore
@eirannejad, I don't have libs on .NET Core
- FileFormatWavefront.dll
- Ifc.NET.dll
- Ifc.NET.XmlSerializers.dll
- Microsoft.WindowsAPICodePack.dll
- Microsoft.WindowsAPICodePack.Shell.dll
- pyRevitLabs.MahAppsMetro.dll (available alpha version)
- PythonStubsBuilder.dll
- Rhino3dmIO.dll
- rhino3dmio_native.dll
- MadMilkman.Ini
- Expression.Blend.Sdk
- transferred pyRevit paths to targets
- added revit 2025 dependensis
- added revit 2026-2025 docs (xml) (removed)
- added revit 2025 project to pyRevit.Runtime
- added revits preprocessor variables like this
- added multitargets net48, net8.0
- remove $(RevitVersion) from version pyRevitLoader
I think we need to divide projects into those that use Revit, just libraries, applications.
Transfer all libraries to nuget, thereby greatly simplifying the assembly of the solution.
Remove destination paths from the solution and compile using dotnet build -c Release -o "pyRevit/bin".
I build to to .netcore
- pyRevitLabs.Json,
- pyRevitLabs.MahAppsMetro
- pyRevitLabs.NLog
- pyRevitLabs (all libs)
- pyRevitLabs.PyRevit.Runtime
I can't build:
- loaders and runners
- pyRevitLabs.IronPython2,
- pyRevitLabs.IronPython3,
- python.net
pyRevitLabs.PyRevit.Runtime.2025 have issue with project.assets.json, because projects have same obj folder and dotnet restore replace project.assets.json on random projects on .net48. Fix this trouble needs to unload other projects and than restore packages and build.
I downloaded and build latest IronPython2, IronPython3, PythonNet.
pyRevitLabs.PyRevit.Runtime build errors (errors in all projects)
pyRevitLoader compiles with warnings
pyRevitLabs compiles with errors (I don't know what is it)
Assembly 'pyRevitLabs.Common' with identity 'pyRevitLabs.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
@jmcouffin, @sanzoghenzo can you download my branch and test build projects?
You need:
- install latest Visual Studio 2022
- install latest .net8.0 SDK
- install .net framework 4.8 SDK
Test projects:
- pyRevit\dev\pyRevitLoader\pyRevitLoader.sln
- pyRevit\dev\pyRevitLabs\pyRevitLabs.sln
- pyRevit\dev\pyRevitLabs.PyRevit.Runtime\pyRevitLabs.PyRevit.Runtime.sln
- pyRevit\dev\pyRevitLoader\pyRevitLoader.sln
compiling properly
- pyRevit\dev\pyRevitLabs\pyRevitLabs.sln
🚀
- pyRevit\dev\pyRevitLabs.PyRevit.Runtime\pyRevitLabs.PyRevit.Runtime.sln
all clear!
@jmcouffin thanks! I am creating ci-build for all dependencies now :)
Holy smokes! @dosymep Great job! Do we have an installer for this?!
@eirannejad I have some problems with IronPython and PythonNet
IronPython I haven’t done PR yet, I need to modify the projects so that they work in the general build
this compiles, but tests fails https://github.com/dosymep/ironpython2/actions/runs/8600244738 https://github.com/dosymep/ironpython3/actions/runs/8600076749 https://github.com/dosymep/dlr/actions/runs/8571559374
pythonnet I did not try to build it because the API there has changed and does not work with the new version of pyRevit. I slightly modified pythonnet so that pyRevit could build to check the general logic for building projects. The new version will definitely not work with pyRevit, you need to modify the pyRevit code for compatibility.
general pyRevit build :( https://github.com/dosymep/pyRevit/actions/runs/8661332584/job/23751026331
pythonnet I did not try to build it because the API there has changed and does not work with the new version of pyRevit. I slightly modified pythonnet so that pyRevit could build to check the general logic for building projects. The new version will definitely not work with pyRevit, you need to modify the pyRevit code for compatibility.
I started updating pythonnet in this PR for devel-4, but I closed it to focus on pyrevit5; I was waiting for things to settle down on the netfx/netcore part.
This week I should be able to carve some time to test your PR and move forward the pythonnet update
I also wanted to link this here. In netframwork we could save dotnet assemblies to a dll file (pyRevit does that for dynamically building assemblies from extensions and linking the UI buttons to it) but this is not possible by default in netcore.
One of our developers working on Rhino.Inside.Revit ended up using this library:
https://github.com/Lokad/ILPack
to generate the dlls and link the Revit UI buttons to it
Hi there, I'm sorry I hadn't time to go through this PR.
I just tried to run the pipenv run pyrevit build products and it fails to build IronPython3.
Thinking out loud here: in a divide et impera (divide and conquer) fashion, could we use the GitHub nuget registry and split the compilation of the dependencies in CI jobs of their own repositories, publish the nuget packages and then just add those as pyrevit dependencies?
For the IronPyhton2 test issue: the logs are gone, but even the CI of the upstream repository has failed jobs. Could it be that the tests are not working properly?
Hi there, sorry again for the really late response....
@jmcouffin, @sanzoghenzo can you download my branch and test build projects?
Test projects:
* pyRevit\dev\pyRevitLoader\pyRevitLoader.sln * pyRevit\dev\pyRevitLabs\pyRevitLabs.sln * pyRevit\dev\pyRevitLabs.PyRevit.Runtime\pyRevitLabs.PyRevit.Runtime.sln
I just tried to compile them in visual studio 2022, only the pyRevitLabs compiles fine, the other two solutions complain about containing "incorrect configurations mappings." and just skip the builds of the projects in them. I don't know where to start fixing this 😅
Thinking out loud here: in a divide et impera (divide and conquer) fashion, could we use the GitHub nuget registry and split the compilation of the dependencies in CI jobs of their own repositories, publish the nuget packages and then just add those as pyrevit dependencies?
I realize only now that you already suggested the same thing a month before 😅
I think we need to divide projects into those that use Revit, just libraries, applications. Transfer all libraries to nuget, thereby greatly simplifying the assembly of the solution. Remove destination paths from the solution and compile using
dotnet build -c Release -o "pyRevit/bin".
I'm all in for it!
I suppose this would further render the pyrevit clone features useless, but I think that there will be less and less need to handle clones and attachments anyway...
@sanzoghenzo In my GitHub Actions I can build all libs except pyRevitLabs.PyRevit.Runtime.*. These projects are not built because there is no compatibility with pythonnet. https://github.com/dosymep/pyRevit/actions/runs/8722474379/job/23928422567
I found out my problem, the DLR submodule for IronPython3 wasn't initialized!
Now my pipenv run pyrevit build products does the same as your CI.
I'll try to fix it this weekend
I started to fix the CPythonEngine class, here's the patch that you can apply to your branch.
It compiles, but another problem surfaced: since the engines are now in "bin\netcore\engines" and "bin\netfx\engines", the generated addin files have the wrong path. This line should be changed in some way, Or we should define an engine for each framework in the pyRevitfile (but then we have to add a way specify which framework the engine runs on). Any thoughts?
I realized I could push to this PR, so I did 😉
Python.net could be treated as a normal library since it is not tied to a python version anymore, so I moved it to the dev/libs/(framework) folders (and since it is a netstandard library, we could even avoid making a duplicate!)
For the same reason, I also moved the cpython engine out of the frameworks folders, created a cengines folder (not sure if it's a great name) and pointed the pyrevitfile for the cpython engine to that location.
I opened a PR in the pythonnet repo to clean it up; we should point to it in the submodule once we merged. Or should we start to use nuget packages right away?
Unfortunately, I still cannot make things work: even if I change the addin manifest manually to point to the right folder, loading the plugin breaks here, it seems that the assembly can't list the resources in it.
I tried to debug it, but visual studio doesn't even show me what asm is, so I'm not sure what is happening there exactly.
Long story short: I'm stuck here!
For references https://www.linkedin.com/feed/update/activity:7200502176698273792?trk=viral_comment
but visual studio doesn't even show me what asm is
This is pyRevitLoader https://github.com/search?q=org%3Apyrevitlabs%20pr_lib.zip&type=code
Or should we start to use nuget packages right away?
about nuget, I think it’s worth freezing it for now and just try to launch pyRevit, since now the build somehow works.
but visual studio doesn't even show me what asm is
This is pyRevitLoader https://github.com/search?q=org%3Apyrevitlabs%20pr_lib.zip&type=code
Yes, I saw them, what I meant is that the debugger can't evaluate the asm value, it tells me that it is not in scope even if the breakpoint is exactly on the asm.GetManifestResourceNames() line (I changed the linq expression into a .Where method call in my local copy, nothing changed).
But thanks for the pointer, I have to re-check what's in EngineVersion; if I remember correctly at one point I got something like "7110" instead of "2711"...
Update: it was indeed the EngineVersion variable with a wrong value!
This was due to the fact that previous pyRevitLoader version was set in the csproj file as $(RevitVersion).2.7.11, now it is only 2.7.12.
Not sure if it is still useful to prepend the revit version here. Changing the EngineVersion getter to read the major, minor and build version (instead of minor, build and revision) solver this issue.
Of course now it tells me that it can't find bin\netfx\engines\pyRevitLoader.py, that was in fact removed.
If re-add the file (adjusting it to point to pyrevitlib, since it is a folder up), I got
IronPython Traceback:
File "...\bin\netfx\engines\pyRevitLoader.py", line 30, in <module>
File "...\pyrevitlib\oyrevit\__init__.py", line 21, in <module>
File "re.py", line 105, in <module>
File "sre_compile.py", line 61, in <module>
File "sre_compile.py", line 61, in <genexp>
NameError: global name 'i' is not defined
but the i in sre_compile.py (at least the on I find in dev/modules/pyRevitLabs.ironpython2/Src/StdLib/Lib) is not global:
# Maps the lowercase code to lowercase codes which have the same uppercase.
_ignorecase_fixes = {i: tuple(j for j in t if i != j)
for t in _equivalences for i in t}
Another blocker for me, do you have any idea?
Meanwhile, to sum up, we need to:
- [x] build the .addin files pointing to the new engines folder (including netfx/netcore in the path based on the Revit version)
- [x] decide on whether to keep the
RevitVersionin thepyRevitLoaders version and change theEngineVersiongetter if we should drop it - [x] restore pyRevitLoader.py, maybe moving it to another, single folder to avoid duplicates, and change the pyRevitLoader and pyrevitlib paths accordingly
- [x] find out what's going wrong with the IronPython inerpreter on loading
- [x] test the CPython engine
(I would port the pyrevitloader to .net right away if you ask me, but I understand it is a major rewrite and it would further delay the release...)
@sanzoghenzo 🤣
[Window Title]
PyRevitLoader - Error Loading pyRevit
[Main Instruction]
IronPython Traceback:
Traceback (most recent call last):
File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\bin\netfx\engines\pyRevitLoader.py", line 30, in <module>
File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\loader\sessionmgr.py", line 24, in <module>
File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\loader\sessioninfo.py", line 14, in <module>
File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\runtime\__init__.py", line 502, in <module>
File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\runtime\__init__.py", line 344, in _get_runtime_asm
File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\runtime\__init__.py", line 295, in _generate_runtime_asm
AttributeError: 'pyRevitLabs.Common' object has no attribute 'CodeCompiler'
@sanzoghenzo 🤣
[Window Title] PyRevitLoader - Error Loading pyRevit [Main Instruction] IronPython Traceback: Traceback (most recent call last): File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\bin\netfx\engines\pyRevitLoader.py", line 30, in <module> File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\loader\sessionmgr.py", line 24, in <module> File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\loader\sessioninfo.py", line 14, in <module> File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\runtime\__init__.py", line 502, in <module> File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\runtime\__init__.py", line 344, in _get_runtime_asm File "C:\Users\dosymep\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\runtime\__init__.py", line 295, in _generate_runtime_asm AttributeError: 'pyRevitLabs.Common' object has no attribute 'CodeCompiler'
One step at a time... you're ahead of me 🤣
Do we still need to compile assemblies? I think that the _generate_runtime_asm function should be removed.. or is this too soon?