Thanks. As suggested previously you have been a bit confused with config paths. In Visual Micro you should leave all empty paths sich as "Sketchbook" and "ContributionsPath". When you leave them empty Visual Micro uses the defaults that are set or configured in the Arduino IDE.
In the Arduino IDE you have set the SketchBook location to B:\Projects. That means that it will use libraries from "B:\Projects\Libraries". (Arduino finds the libraries that you install in the "sketchBook\Libraries" folder).
In Visual Micro you have set the sketchBook location to "B:\VisualMicro" therefore libraries would be expected in "B:\VisualMicro\Libraries"
In the Arduino IDE you are using the esp8266 package as expected. You installed the 8266 package using the Arduino IDE board manager and the package is installed into the standard Arduino package location. users\[youname]\app_data\arduino15\packages
In Visual Micro you have configured downloaded packages to reside in the "B:\VisualMicro" folder. That means you are using a different esp8266 package than you are using in the Arduino IDE
In the Arduino IDE you are working with code from "B:\Projects\contact_homekit\ContactSensor_HomeKit"
In Visual Micro you are working with code from "B:\VSProjects\ContactSensor_HomeKit"
I can't see any part of this that can be fairly compared with the Arduino IDEĀ
I can see you have some good thought about managing code and seperation but my recommendation would be to step back until you have a clearer view of things.
These two actions will cause visual micro to use the same core and libraries that are being used in the arduino ide
- Clear the contributions path that you have set in either "IDE locations" or "Global options".
- Clear the sketchbook folder you have set in the "IDE locations".
- Delete the package and library you have added to your disk
After that you can open the same "B:\Projects\contact_homekit\ContactSensor_HomeKit" in Visual Micro that you are using in the Arduino IDE. After that it will build the same as the Arduino IDE using the same configuration as the Arduino IDE
After you prove you have same system in Arduino and Visual Micro you will be welcome to create a new thread asking for advice about consolidating toolchains, libraries and project code into an isolated location for easier source control.
Does this help?