Login Page - Create Account

Support Board


Date/Time: Fri, 18 Oct 2024 09:16:31 +0000



Post From: VS2022: Pre/Post Build Events DLL Issue

[2024-07-08 16:53:53]
ondafringe - Posts: 277
Okay, let me finish this thread by saying, I solved my Pre-/Post-Build issues and everything is working to my satisfaction. And just in case someone who wants to use VS runs across this thread in the future, here is the overview.

As mentioned, above, the problem was, when running the release-DLL PowerShell (PS) script from the Pre-Build event within VS, the script ran without error, but SC did not release the DLL, so the DLL could not be opened for writing/updating. But when I manually opened a PS window and manually ran the script from there, it worked as expected. I couldn't figure out what was going on, but after a lot of digging around, reaching out on Microsoft's Visual Studio Developer Forum, etc., I did gather enough information to get me across the finish line.

It seems VS needs an extension to successfully run PS scripts. Plus, I am running Win10 Pro and was still using PS version 5.1 and, from what I could tell, I needed at least version 6.

So, in VS, I installed the PS extension, and I downloaded/installed the latest version of PS (as of this post, version 7.x). Then, in the Pre- and Post-Build events in VS, I ran the PS script in the most basic way (without the need to bypass any PS Execution Policies). The script ran without error, SC released the DLL, the DLL was deployed/updated, and then SC reloaded the DLL. That was it. The changes took effect immediately. Nothing else had to be done in SC (unless something was changed in Set Defaults) -- and that includes not having to: Analysis>Build Custom Studies DLL>Build>Release All DLLs and Deny Load.

Now that VS is setup properly, it is actually a little faster (fewer clicks) to create/build/edit/deploy my custom study DLLs using VS than it is to do all that within SC -- one click on Build and it's a done deal.
Date Time Of Last Edit: 2024-07-08 17:26:51