Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) How to update project libraries? (Read 4266 times)
M@rcel
Junior Member
**
Offline


Posts: 12
Joined: Oct 31st, 2020
How to update project libraries?
Mar 12th, 2021 at 4:25pm
Print Post  
Searching through the documentation, this forum and the internet, I cannot find an answer to this question:

I have project-local libraries in my VsStudio solution. How do I update these to a newer version (of the same libs)?

Thanks!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to update project libraries?
Reply #1 - Mar 12th, 2021 at 4:45pm
Print Post  
if you used the clone just delete them and re-clone or delete the folder and copy the latest over.

Use the library manager to install the correct version before doing so, that way your documents/arduino/libraries will have also have the same version, then clone or copy that.

Make sense?
  
Back to top
IP Logged
 
M@rcel
Junior Member
**
Offline


Posts: 12
Joined: Oct 31st, 2020
Re: How to update project libraries?
Reply #2 - Mar 12th, 2021 at 6:23pm
Print Post  
So, if I understand you correctly, there is no "upgrade local project libraries" feature? copying by hand is, although possible, a nuisance because of the versioning in the project-library directory.

Maybe a new feature? In the meantime, I will try your suggestions.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to update project libraries?
Reply #3 - Mar 12th, 2021 at 7:35pm
Print Post  
If you originally copied your library to the project libraries folder then you should continue to do same because the code could have come from anywhere.

If you use the git source control or tfs option in visual studio to manage your source it will automatically handle versioning for you allowing you to review all preview changes simply by right clicking files in the solution explore > view history or > compare etc.
  
Back to top
IP Logged
 
M@rcel
Junior Member
**
Offline


Posts: 12
Joined: Oct 31st, 2020
Re: How to update project libraries?
Reply #4 - Mar 12th, 2021 at 7:43pm
Print Post  
I use 
- Clone for project when including libraries
- Clone library versions

libraries are put into a subdirectory containing the version. A new version of the library should, therefore, go into a new directory. This is quite cumbersome to do manually.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to update project libraries?
Reply #5 - Mar 12th, 2021 at 7:49pm
Print Post  
If you use clone then it is easy. Install the new library with Library Manager, clone the new library then remove the "Reference" from the Arduino project to the cloned library you no longer use.

The clone automatically uses the version of the library when cloning, therefore the older version can remain. You can organize the libraries in the solution explorer to clearly show the version numbers of same libraries. The "References" folder below the Arduino project in solution explorer gives you control over which of the various library version you actually want to use.
« Last Edit: Mar 12th, 2021 at 7:49pm by Tim@Visual Micro »  
Back to top
IP Logged
 
M@rcel
Junior Member
**
Offline


Posts: 12
Joined: Oct 31st, 2020
Re: How to update project libraries?
Reply #6 - Mar 12th, 2021 at 7:51pm
Print Post  
but headers are included again in the source?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to update project libraries?
Reply #7 - Mar 12th, 2021 at 8:17pm
Print Post  
Sorry I am not sure I understand what you are asking.

There are no paths to headers in your .ino code, which ever library is set as the Project>Reference is the one that will be used during compilation. You can have multiple versions of the same library in the solution.

Does this answer your question?
« Last Edit: Mar 12th, 2021 at 8:18pm by Tim@Visual Micro »  
Back to top
IP Logged
 
M@rcel
Junior Member
**
Offline


Posts: 12
Joined: Oct 31st, 2020
Re: How to update project libraries?
Reply #8 - Mar 12th, 2021 at 8:26pm
Print Post  
Let me rephrase:

When I clone again (with the updated library), then yes the reference is updated. What I meant is that a new (superfluous) #include is generated and added to the .ino.

Sorry, newbie here  Wink
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to update project libraries?
Reply #9 - Mar 12th, 2021 at 8:31pm
Print Post  
I see, it should only add #includes if they are missing or different. Were the existing ones identitical?
  
Back to top
IP Logged
 
M@rcel
Junior Member
**
Offline


Posts: 12
Joined: Oct 31st, 2020
Re: How to update project libraries?
Reply #10 - Mar 12th, 2021 at 8:33pm
Print Post  
No, the original(s) only referenced the main headerfile of the lib. Visualmicro added #include's to all headerfiles in the lib.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to update project libraries?
Reply #11 - Mar 12th, 2021 at 8:38pm
Print Post  
That is correct. It is how things work for Arduino. You can remove the ones you don't want. The alternative would be not to add any headers which would be very confusing. Often there is not a header that matches the name of the library, therefore it would more problematic for users who don't know what header(s) to include or what a header is.

Hopefully, you are saying that you can now see how to easily support multiple versioned libraries and use the preffered one at any one time?
  
Back to top
IP Logged
 
M@rcel
Junior Member
**
Offline


Posts: 12
Joined: Oct 31st, 2020
Re: How to update project libraries?
Reply #12 - Mar 12th, 2021 at 9:21pm
Print Post  
Because it is usually documented with the library which headers to include: Is it possible to disable the inclusion altogether?

Lol, yes I am happy with how it's working!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to update project libraries?
Reply #13 - Mar 12th, 2021 at 10:12pm
Print Post  
Great. If the library.properties does not contain an includes= we add all headers, that can't be switched off but an "Undo" in the .ino code should remove them if they have just beedn added.

If the library.properties contains one of more comma seperated .h names then only those .h files are automatically added to the code when adding libraries.

library.properties

includes=file1.h,file2.h

  
Back to top
IP Logged
 
M@rcel
Junior Member
**
Offline


Posts: 12
Joined: Oct 31st, 2020
Re: How to update project libraries?
Reply #14 - Mar 12th, 2021 at 11:05pm
Print Post  
Undo works. Ok, thank you for all your support!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to update project libraries?
Reply #15 - Mar 12th, 2021 at 11:24pm
Print Post  
Great thanks for the update
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint