|
49 | 49 | # Build strategy constant (Roslyn is the only supported strategy) |
50 | 50 | BUILD_STRATEGY_ROSLYN = "Roslyn" |
51 | 51 |
|
| 52 | +# Minimum Revit version that supports the new C# loader. |
| 53 | +# Revit 2019/2020 ship an older .NET Framework and system assemblies |
| 54 | +# (System.Runtime.CompilerServices.Unsafe, System.Collections.Immutable) |
| 55 | +# that are incompatible with the Roslyn version bundled in pyRevit. |
| 56 | +NEW_LOADER_MIN_REVIT_VERSION = 2021 |
| 57 | + |
52 | 58 |
|
53 | 59 | AssembledExtension = namedtuple("AssembledExtension", ["ext", "assm"]) |
54 | 60 |
|
@@ -389,6 +395,23 @@ def load_session(): |
389 | 395 | # create a new session |
390 | 396 | if not user_config.new_loader: |
391 | 397 | mlogger.info("Creating new pyRevit session with pyRevitLoader.py...") |
| 398 | + mlogger.debug( |
| 399 | + "The legacy Python loader is deprecated and will be removed in " |
| 400 | + "future releases. Enable the new loader in pyRevit settings." |
| 401 | + ) |
| 402 | + _new_session() |
| 403 | + elif HOST_APP.is_older_than(NEW_LOADER_MIN_REVIT_VERSION): |
| 404 | + mlogger.warning( |
| 405 | + "The new C# loader is not supported on Revit %s (requires Revit %s+). " |
| 406 | + "Falling back to the legacy Python loader automatically.", |
| 407 | + HOST_APP.version, |
| 408 | + NEW_LOADER_MIN_REVIT_VERSION, |
| 409 | + ) |
| 410 | + mlogger.warning( |
| 411 | + "The legacy Python loader is deprecated and will be removed in " |
| 412 | + "future releases. Upgrade to Revit %s or newer to use the new loader.", |
| 413 | + NEW_LOADER_MIN_REVIT_VERSION, |
| 414 | + ) |
392 | 415 | _new_session() |
393 | 416 | else: |
394 | 417 | mlogger.info("Creating new Session with pyRevitAssemblyMaker.dll...") |
|
0 commit comments