03-12-2009 09:28 AM
The me preface the post by saying that I am a new TestStand user. I am learning as I go along here.
I know how to do this in LabVIEW, but I have a need to instantiate a .NET assembly in TestStand. I also have a XML config file that needs to be used with my TestStand project.
In LabVIEW I have to rename my config file to XXXX.lvproj.config where XXXX is the given project name. Then I would use the .NET Constructor Node to instantiate my assembly. From that I would connect the .NET refnum to a property node or an invoke node to do what the assembly was meant to do.
My question is how do I do this in TestStand. I have made a Workspace and placed a project in that workspace. In the project I have made several sequences that should accomplish all the methods contained within my .NET assembly. I used the .NET adapter >> Pass/Fail Test. In the Module Tab I have selected the assembly and the Class that I intend to use, then I choose Do Not Call and check the Create Object box.
When I try to run this sequence I think I have instantiated the assembly but It cannot find the config file. I see an Error box popup talking about an exception thrown due to a missing config file. I have tried renaming my config file to the Workspace name, Project name, and sequence name but have had no luck getting past this step. Anybody have experience using a .NET assembly config file within TestStand? If so some pointers would be much appreciated.
Attached is the XML config file I am using...username has been removed (remove the .txt extension)
Also attached is a screen capture of my TestStand Workspace.
What does Create Object and Show Base Class Members do?
When I call a specific class I am forced to put something in the Object Reference, what is supposed to go there?
Solved! Go to Solution.
03-13-2009 04:25 PM
Hi Matt,
Putting the xml file in the teststand bin directory (default C:\Program Files\National Instruments\TestStand 4.1.1\Bin), and renaming it SeqEdit.exe.config should make the sequence recognize the file. As for your other questions, the TestStand help has information on the Create object and Show Base Class members options as well as the Object reference control; just search ".NET module tab". Please let me know if you need more information or have any other questions and I'll be happy to help!
03-13-2009 09:08 PM
Hi Matt,
Its sounds like you are loading the assembly correctly in order to intantiate the object and use it inside of your TestStand sequence.
Regarding the XML config file, I'm not sure I understand what you are attempting to do?
Do you want the config file to load when the Sequence Editor (or Operator Interface) loads? Or is the config file specific to your assembly?
If it is the latter, what does it do?
In the first case (and likely the second case), as Al mentioned, you should be able to load the config file by dropping it (and renaming it) in the same directory as the executable for the Sequence Editor (or Operator Interface). This defaults to <TestStand>\Bin
This is similar to an issue another customer posted a while ago:
NI TestStand Forum: .NET assembly requires app.config file, can't find it when called from TestStand
And the solution described in this article:
Hope that helps!
03-16-2009 10:05 AM
Thank you for the responses. I placed my config file in the TestStand bin directory and renamed the file like suggested. That solved that problem, thank you. Here is a question about that process though...What if I am working on different projects each of which has an app.config file? How am I supposed to keep straight which config file I am using? Fortunately this is not the case for me but I have to assume there is somebody out there that has this issue.
The app.config file is specific to my .NET assembly I am using. It goes out and opens specific ports and applies my username to allow me to connect to a data service, gather needed data, and display it in real time on my front panel. I have one config file that creates a sort of proxy for all the devices that I need to connect to through the data service.
As I mentioned in my original post, I am learning TestStand as I go along here. I am not sure I understand the difference between the Sequence Editor and the Operator Interface. Could you explain that please? Ultimately when I am done creating my sequences I will deploy my main routine to a server where a test engineer will run my test sequence to initialize all equipment and then run a test.
03-17-2009 12:08 PM
Hi Matt,
When you use TestStand, you are actually using a sequence editor interface to communicate with the TestStand engine. This interface uses TestStand properties and methods to complete tasks. The most widely used interface is the TestStand sequence editor, which is located in theTestStand directory in the start menu. Alternate interfaces, called operator or user interfaces, developed in other environments such as LabVIEW and CVI, are also shipped withTestStand. These User Interfaces can be accessed in the start menu under TestStand»User Interfaces. Take a look at this forum thread for more information on when to use the user interfaces. Hope this helps!
03-17-2009 02:49 PM
Hi Matt,
to answer your other question regarding multiple config files, one way to go about this would be to write the main SeqEdit.exe.config to call another config file with all the necessary information:
<configuration>
<appSettings file="DescriptiveName.config">
</appSettings>
</configuration>
This way, you can have a number of config files, each with descriptive names, and changing config files is as easy as modifying a line in the main SeqEdit.exe.config file. This article has more information on the appSettings file attribute:
MSDN: .NET Framework General Reference Configuration file Syntax - appSettings
Let me know if you have any other questions!
03-18-2009 09:44 AM