Skip to content
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

Development of .NET 6.0/7.0 add-in without close SolidWorks #128

Open
jesse-21499 opened this issue Jun 8, 2024 · 3 comments
Open

Development of .NET 6.0/7.0 add-in without close SolidWorks #128

jesse-21499 opened this issue Jun 8, 2024 · 3 comments

Comments

@jesse-21499
Copy link

Is it possible to modify source code of .NET 6.0 or 7.0 SW add-in (allowing build and write to dll after stop debugging and unload add-in in SW) without close and restart SolidWorks?
When I try to do this, dll file is locked for writing and I need to exit and restart solidworks.
I'm using Xarial.XCad.SolidWorks (0.8.0) and .NET 7.0

@artem1t
Copy link
Contributor

artem1t commented Jun 16, 2024

I am afraid it won't be possible. .NET dlls are loaded into the process so it cannot be unloaded from the process. There is a way to load into a different app domain, but I would not recommend going this route. But you can edit the code (most of it) ad-hoc while debugging via hot reload.

@jesse-21499
Copy link
Author

Thanks for the information.
I've tried using XArial to develop add-in that access methods from 3'rd party add-in (C++ based) loaded in SW.
External C# exe (console,winform or WPF) is good for temporarily develop and debug purposes without restart SW but is not possible to pass the IActiveDoc document argument to C++ based add-in methods. Addin is needed.
So I will build portions of code that access 3'rd party C++ API inside auxiliary add-in and try to use HotReload.
Also tried using C++ COM NonAttributed Addd-in from SW API but after unload add-in, SW takes about 15 or 20 minutes to free or release COM pending objects,call ExitInstance() and unload DLL,leaving it unlocked for writing.

Sorry for my english
Regards

@spiriapbergeron
Copy link

I can use "edit-and-continue" in my addin most of the time no problem. I have never tried to modify xcad itself though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants