08-28-2020 09:41 AM
Hi!
So I've made this dumb mistake of copying files from one project to another, done some modifications on it, only to realize now that I was not working on a copy of the original, but the reference was still here.....
Anyway I'm looking for some recommendations for good tutorials on how to handle the project explorer and "copying" files from one project to another as in creating a new reference.
I've seen numerous stuff online (including NI courses) but they are either not really helpful or way too long to invest time without being recommended (I've seen too many bad tutorials in the past, teaching you things not recommended)
Thanks in advance for your help.
Vinny.
Solved! Go to Solution.
08-28-2020 12:03 PM
Hi Vinny,
So assuming that you have an existing project open, and you'd like to make a copy of some of the contents (to be later used in a different project), you can do the following:
For libraries:
For classes:
For VIs:
Separately from the above, if you want to make reusable code, consider having one "source" folder that contains the code you're developing (VIs, ctls, lvlibs, etc) and then using a PPL (Packed Project Library) or packaging technology (e.g. VI Packages via VIPM) to produce some "output" and install that. Then, have any code that should use your code reference the installed copy. Be very careful not to reference the source version!
08-28-2020 12:23 PM
1. There is a great feature of the Project Explorer that is not widely used. In the Project menu, select Show Item Paths. You will now be able to confirm the exact location of every VI project and easily spot something out of place.
2. You should also try to use auto-populating folders. Virtual folders can invisibly contain items in other projects.
3. Beware of File->Save As. It will default to the last location which might be the old project.
08-28-2020 02:31 PM - edited 08-28-2020 02:32 PM
I have found the best way is to:
08-28-2020 04:49 PM
@Michael_Munroe wrote:
1. There is a great feature of the Project Explorer that is not widely used. In the Project menu, select Show Item Paths. You will now be able to confirm the exact location of every VI project and easily spot something out of place.
2. You should also try to use auto-populating folders. Virtual folders can invisibly contain items in other projects.
3. Beware of File->Save As. It will default to the last location which might be the old project.
I disagree with #2 if you practice #1. You can open the virtual files and immediately notice if something seems "out of place". There are many advantages to using virtual folders, particularly regarding versioning software. Oftentimes, nothing changes at all if you move a file from one virtual folder to another. Moving from one autopopulating folder to another can cause the need for massive commits to the repository.
08-31-2020 02:22 AM
@cbutcher wrote:
Hi Vinny,
So assuming that you have an existing project open, and you'd like to make a copy of some of the contents (to be later used in a different project), you can do the following:
For libraries:
- Right click on library (.lvlib) file and go to Save > Save As...
- Leave "Copy" (the default, top option) selected
- Deselect the "Add copy to..." option (you probably don't want it to be a part of your existing project
- Click Continue, then choose a new folder for it (not a file, but a folder - note the "Current Folder" button at the bottom if you've already created the target location)
For classes:
- Basically the same as libraries (classes are a variation on libraries)
For VIs:
- Open the VI (it doesn't seem like there's a right click option here for me)
- Go to File > Save As...
- Choose to Copy - Create unopened disk copy (this will not become a part of your existing project)
- Note that you can also consider "Duplicate hierarchy to a new location" - this is more useful if you have a collection of VIs that are not in a library. But maybe it would be better to put them in a library first, and then copy that 😉
Separately from the above, if you want to make reusable code, consider having one "source" folder that contains the code you're developing (VIs, ctls, lvlibs, etc) and then using a PPL (Packed Project Library) or packaging technology (e.g. VI Packages via VIPM) to produce some "output" and install that. Then, have any code that should use your code reference the installed copy. Be very careful not to reference the source version!
Hi Cbutcher.
Thanks for your answer, I will consider having a source folder that's a good idea. I am still confused with what NI has to offer sometimes (VIPM vs NI package manager etc.) But I'm getting there.
Another question:
Let's say you have a VI/Library... in the folder you want it to be. How do you import it in your project in the best way ?
- Do you use the "Open" button in the project view
- Can you just drag and drop the VI/Library into your project?
What happens then if ever the VI for instance has some dependencies to other VIs I made and are elsewhere?
Thanks again, now I need to fix the mess I made 😅
Vinny
08-31-2020 02:26 AM
@billko wrote:
I disagree with #2 if you practice #1. You can open the virtual files and immediately notice if something seems "out of place". There are many advantages to using virtual folders, particularly regarding versioning software. Oftentimes, nothing changes at all if you move a file from one virtual folder to another. Moving from one autopopulating folder to another can cause the need for massive commits to the repository.
I'm actually also looking into how to manage versionning. We are using SVN here and I saw a few articles detailing how to work with it in labview, I need to look at it in details.
That actually makes me think of build specifications: I believe it is better to have all files on the same drive and not to have some on my drive and other on our servers, right? (might be for another post though).
Vinny.
08-31-2020 04:31 AM
PS: I'm still looking for some good tutorials on how to manage properly a project explorer, explaining the use of libraries, shared and packed ibraries, how to organize it in an effective way etc.
Thank you for any suggestions 🙂
Vinny.
09-01-2020 09:13 AM
@VinnyAstro wrote:Another question:
Let's say you have a VI/Library... in the folder you want it to be. How do you import it in your project in the best way ?
- Do you use the "Open" button in the project view
- Can you just drag and drop the VI/Library into your project?
I usually use the right click on parent item (e.g. Virtual Folder, or Target (My Computer, etc)) and then go to Add > File.
I *think* dragging and dropping would do the same thing (from e.g. Explorer).
@VinnyAstro wrote:What happens then if ever the VI for instance has some dependencies to other VIs I made and are elsewhere?
If the VI has dependencies, those will also be loaded. Probably you'll get a search box if the VIs are at different relative/symbolic (in the sense of vi.lib, instr.lib etc) paths than expected.
It looks like you already found the forum issue with only being able to quote one reply, so I'll quote you now in red and indented:
That actually makes me think of build specifications: I believe it is better to have all files on the same drive and not to have some on my drive and other on our servers, right?
I'd personally suggest that you keep whatever source code you're developing on your hard drive (whereever is convenient to develop it) and then install "built" products (e.g. via VIPM, NIPM) into specific directories. There seem to be a large number of possible options (and people don't generally seem to have converged on any particular workflow), so you should go ahead and read various forum posts or see videos recorded at previous NI Weeks.
The wiki page here might be useful regarding possible packaging options: Package Manager Comparison
02-24-2021 02:08 PM
If you want a good beginner's overview for using Project Explorer, try this one.