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
Normal Topic .vcxitems (Read 192 times)
My Screen Name
Junior Member
**
Offline


Posts: 13
Joined: Nov 7th, 2023
.vcxitems
Apr 15th, 2025 at 10:40pm
Print Post  
Hi,

Had to do a complete re-install of my OS and of course also re-install VS2022 and VisualMicro (very latest version). 

Now trying to build my project again. My project uses a number of libraries, for example 'SHT31-0.5.0', I'll focus on this one but the same applies to the other ones.

Using the Library Manager in VisualMicro Explorer I have installed that very library and indeed the 'SHT31-0.5.0.zip' file now appears in my '%APPDATA%\Local\arduino15\staging\libraries' folder and in my 'Documents\Arduino\libraries' folder there is a subfolder 'SHT31', it also appears in the dropdownbox at vMicro->Add Library->User Installed. So far so good I would think.

Yet when I load my project.sln in Solution Explorer it says 'SHT31-0.5.0 (not found). When I right-clight it and select 'Reload Project' I get a message 'The project file 'Documents\Arduino\libraries\SHT31\SHT31-0.5.0.vcxitems' has been moved, renamed or is not on your computer'.

And indeed it is not. In the SHT31 folder are simply the contents of the zip file, and in the zip file is no file with a .vcxitems extension.

I do have a backup of my 'Documents\Arduino\libraries\SHT31' folder from before the new OS and that backup does have the required SHT31-0.5.0.vcxitems file. Now of course I can restore this file from that backup but I want to understand what is going on. Where does the .vcxitems file come from? Was it at some point generated by VS2022? Or VisualMicro? 

Google tells me .vcxitems are 'Share Items Project' files. In 'vMicro->Add Library->Library Advanced' there is an option 'Create Shared Project When Including Libraries', I though maybe that is what I need but selecting that option gives me a warning 'Creating shared projects for libraries is not recommended in most cases......... Would you still like to enable this Feature? Yes/No'. I am now hesitant to select Yes because I don't know what is best.

Since it's been years since my previous OS install I just don't remember how I set up everything at the time.

Can anyone tell me what the correct/preferred way is of installing/using libraries and what the deal is with the .vcxitems files?

From memory if I wanted to use a library, like the 'SHT31-0.5.0' one in Micro Explorer I would go to the Installed tab, search for that library and click it and a reference would be added to my solution. That however does nothing right now so maybe I don't remember this correctly.

Also to this day I still don't really understand what the IDE selection does. I have the option between 'Arduino 2' and 'Visual Micro (No IDE)'. Why is it called 'No IDE' as clearly I do have an IDE installed: VS2022 (and Arduino 2). Switching between the 2 options also seemingly makes no difference.

TL;DR : How do I get the .vcxitems files re-generated and if I shouldn't use them, then how do I use the libraries?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: .vcxitems
Reply #1 - Apr 16th, 2025 at 9:27am
Print Post  
Thanks for the report.

Quote:
I get a message 'The project file 'Documents\Arduino\libraries\SHT31\SHT31-0.5.0.vcxitems' has been moved, renamed or is not on your computer'.


You do not need shared projects unless you intend to edit the lib code. They make it easier to do that.  You can remove it from the solution, then visual micro will use the standard arduino compatible library discovery which is automatic.

Previously you had enabled the option to create a shared project for libraries but you did not enable the option to clone the libraries. The clone copies the sources to a safe location that won't be overwritten by updates. It's simpler not to use shared libraries unless they are fully understood.

If you need to see the lib sources in your solution then use the "vMicro>Show Hidden Files" option. This gives a dynamic view of currently used libraries without need for a vcxitems to be located alongside the library sources.

Quote:
Also to this day I still don't really understand what the IDE selection does. I have the option between 'Arduino 2' and 'Visual Micro (No IDE)'. Why is it called 'No IDE' as clearly I do have an IDE installed: VS2022 (and Arduino 2). Switching between the 2 options also seemingly makes no difference.


The IDE Selection simply determines where Visual Micro should inherit settings from, so board packages / libraries etc can be shared between vMicro and the IDE selected.

The Arduino2 selection will use the *.yaml / environment variable settings as per the Arduino 2 IDE.

The No IDE option means that no IDE settings will be inherited.

If everything is installed in the default locations there is no discernible difference between the two (i.e board packages are in %LOCALAPPDATA%\Arduino15, and the Sketchbook is in %USERPROFULE%\Documents\Arduino)
« Last Edit: Apr 17th, 2025 at 1:43pm by Tim@Visual Micro »  
Back to top
IP Logged
 
My Screen Name
Junior Member
**
Offline


Posts: 13
Joined: Nov 7th, 2023
Re: .vcxitems
Reply #2 - Apr 18th, 2025 at 1:00pm
Print Post  
Thank you very much for the detailed answer.

I understand now why/when one would use shared libraries. One reason to have the shared projects that you didn't mention but which I find handy myself is that that way I can immediately see which version of a library my code is supposed to work with.

If say SHT31-0.5.0 is a shared project (and this visible as SHT31-0.5.0 in my solution explorer) then even after a complete re-install 2 years laters I immediately know that my code will work with SHT31-0.5.0 and might not work with the then latest version SHT31-x.y.z.

As a fix (for when not using shared projects) I have now added a versions.txt file to my code that lists the actual library versions it should be compiled against. If anyone knows of a better way I'd be happy to hear it.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: .vcxitems
Reply #3 - Apr 18th, 2025 at 4:45pm
Print Post  
Yes that is a good question. You can either isolate the board core(s) and libraries below special solution folders or just isolate libraries. This means that a solution folder structure contains everything your project(s) need to run and can not be broken by updating or uninstalling the standard Arduino locations.

If you want to capture your libraries alongside the project/solution, there is now a simpler file system based approach which is detailed on the below page, which is easier to move between machines, and does not directly affect the solution/project files so cannot generate the same issues you are seeing here in the future:

https://www.visualmicro.com/page/How-to-Encapsulate-Libraries-Within-a-Solution....

If you would like to encapsulate everything then let us know and we will provide a docs link or see the docs page
  
Back to top
IP Logged
 
My Screen Name
Junior Member
**
Offline


Posts: 13
Joined: Nov 7th, 2023
Re: .vcxitems
Reply #4 - Apr 24th, 2025 at 6:48am
Print Post  
A little update:

Since I am now no longer using shared projects my build times have gone down from something like 10 minutes to under a minute. 

It's now a lot of "Using previously compiled file: xyz.cpp.o

Choice! Very happy with this.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint