03-30-2012 06:03 PM
TestStand: use variable in .Net module assembly path
I want to use a variable in the .Net module's path.
For example, if I am doing debug, like in Vuisual Studio, I will set the module path like this:
..\..\..\Projects\NGRDriver\InstrumentInteraction\bin\Debug\InstrumentInteraction.dll
For release:
..\..\..\Projects\NGRDriver\InstrumentInteraction\bin\Release\InstrumentInteraction.dll
Instead how about this:
..\..\..\Projects\NGRDriver\InstrumentInteraction\bin\%ConfigurationName%\InstrumentInteraction.dll
(inherited from VS2010 c# project)
Even better, set up a variable assigned by a property loader:
DotNetBin, ..\..\..\Projects\NGRDriver\InstrumentInteraction\bin\Release\
In module > Assembly
$(DotNetBin) InstrumentInteraction.dll
Can this be done?
04-02-2012 09:50 AM
There is not currently a way to do this. What I'd recommend instead is a directory structure more like the following:
Projects\Debug\NGRDriver\InstrumentInteraction\InstrumentInteraction.dll
Projects\Release\NGRDriver\InstrumentInteraction\InstrumentInteraction.dll
Then add a simple search directory (do not use the subdirs option) as follows depending on which configuration you want:
Projects\Debug
or
Projects\Release
And specify your code modules as follows:
NGRDriver\InstrumentInteraction\InstrumentInteraction.dll
You can programmatically change search directories using the teststand API. You will likely also need to call Engine.UnloadAllModules after making this switch. Especially for .NET modules since if the old version is still loaded, that is what .NET will use. Also for .NET you need to make sure you aren't holding any references to .NET objects when you unload all the modules as they will keep all of the .NET modules from getting unloaded. In order to unload .NET modules the appdomain must be unloaded and since all of the code modules are in the same appdomain, all of the .NET code modules must be unloadable for any of them to unload.
Hope this helps,
-Doug