-
-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load C# assemblies at startup #1335
Comments
Hello. |
Thanks @dosymep ! Would you use it in the startup code or in the plugin code? Do you have an example? Cheers |
Simple example command class:
|
Thanks @dosymep for the sample code. I tried it again, but this doesn't really fix my issue. AppDomain.CurrentDomain.AssemblyResolve just tells me when there's an issue with one of the dlls, but it doesn't really fix it. |
@Dre-Tas, The finding dll does exist? |
@Dre-Tas, |
Yeah @dosymep the dll definitely exists and it's in the right folder (together with the other dlls that get loaded correctly. It seems to be a problem with the versions of the dll (as per my first post at the top) |
@Dre-Tas, I understand what is problem. Pyrevit load assemblies without context that's why my code doesn't work. |
@dosymep you can actually use LoadFrom in the startup.cs |
@Dre-Tas, I have created project witch use these libraries and then specified absolute paths in CurrentDomain_AssemblyResolve, and this project began executing. (pyrevit-extension - replace to your path) |
Nope not working for me :( Now I just managed to use all packages that use the same version of the dependencies. It wasn't easy and I don't think it's going to work as a long-term solution, but we'll see. In the meantime I'm having another weird error in Revit 2019, but I'm gonna post a separate issue. |
I'm just reading the thread here but a couple of things aren't clear:
I'm trying to figure out where does pyRevit fit into the picture here. I heard that this error is stopping you from deploying your tools on Revit 2019 so I'm ready to have a zoom chat as well if you think that'll help |
Thanks @eirannejad for the reply! Sorry for the confusion. I'm using a And sorry for the further confusion: The exception from the first post happens in all versions of Revit. To be honest I'm trying to figure out myself if this is a pyRevit thing or not. I think it might be, as it's pyRevit loading those Azure assemblies and expecting certain versions. Zoom sounds great! Do you want me to send you some files first to have a look at it or do you prefer calling first? |
Yes. Let's schedule something for Friday maybe? |
Any chance we can do during the week? Your Friday would be my Saturday morning and considering they just lifted the lockdown here in Sydney I'll probably try and get away for the weekend 😉 |
@eirannejad let me know when you want to do that zoom call. I'll be home most of the day this Saturday so we can schedule it your Friday if it's the best time for you |
@Dre-Tas Sounds great. I 'm open anytime Friday afternoon and Saturday (or Sunday) on Pacific Standard Time. Let me know what's a good time slot is for you and I'll send an invite :D |
Part of this issue seems to be resolved. The rest is on #1373 |
Worked for me while trying to use Google Sheets API |
For those who encounters the same issue, I am making an invoke button and ran into the same problem, the assemblies couldn't got resolved even though I registered the AssemblyResolve event in Execute() with the LoadFrom method, I suppose the dependencies are checked before the execution. |
Hey Ehsan!
I'm having issues with the startup script (C#) when initially loading the assemblies that are going to be necessary for the plugin.
The main issue seems to be with versions of the assemblies.
I'll use an example of what I'm trying to do to be more clear:
I'm creating a dockable panel at startup (we discussed here some months ago) and this panel, when being created gets some info from a database.
I'm storing some secrets to access this database on Azure Key Vault, hence, I'm using the NuGet packages called
Azure.Identity
andAzure.Security.KeyVault.Secret
that allow me to retrieve those secrets from Azure. Both those packages have a third package calledAzure.Core
as a dependency, but they reference 2 different versions of it.Identity
needs Azure.Core >= 1.17 andSecurity
needs >= 1.15. I initially installed 1.19 so that I was sure it was working for both.And this is where the problem is: pyRevit seems to load one version of Azure.Core (what gets built by VS, which is v1.19) but then it complains that it's not finding the right version
It sort of seems to lose the information that any version that is >= of version 1.x is fine.
I tried many different versions of all the packages but at some point something always goes wrong. I also found and tried to use the versions of
Azure.Identity
andAzure.Security.KeyVault.Secret
that use the same version ofAzure.Core
and at that point the error above didn't happen anymore, but it happened with another assembly.This is how I'm loading the assemblies in
startup.cs
But I also tried with Assembly.Load and Assembly.LoadFile with the same results.
Am I missing something? Is there a way to load the assemblies without specifying which version it is? Or maybe it's something else?
Cheers!
The text was updated successfully, but these errors were encountered: