How to solve: The "Microsoft.VisualStudio.ProjectSystem.References.UnresolvedBuildDependencyProjectReference" reference could not be resolved? - c++

In the Solution Explorer, the vcxproj projects that have references, show a warning symbol on each of the references associated with the project. When the reference is highlighted, the properties panel indicates that the Full Path is:
The Microsoft.VisualStudio.ProjectSystem.References.UnresolvedBuildDependencyProject Reference" reference could not be resolved.
If the "..." box is pressed, the same error messagebox is shown and I am unable to select a new reference. I have tried deleting the reference and adding it again, but the result is the same. When new projects references are added, the result is the same.
All this happens when I compile using the Visual Studio 2008 (v90) toolset. If I compile using the Visual Studio 2015 (v140) toolset, the Full Path to the referenced library is shown correctly.
Some Background:
I upgraded my project from Visual Studio 2008 to Visual Studio 2015. This project contains a mix of managed and unmanaged with type .vcxproj. On this machine, the Visual Studio 2008 redistributable has been installed. This enabled me to compile using the Visual Studio 2008 (v90) toolset. My intention is to first compile my project with my VS2008 settings within VS2015 (For restrictive reasons, I have to use the v90 toolset). Thus, I configured the VC++ directories accordingly. There is no Linker option in the Configuration properties of the linking project. In the properties of the reference, the following configurations are enabled:
Copy Local - True
Copy Local Satellite Assemblies - False
Reference Assembly Output - True
Link Library Dependencies - False
Use Library Dependency Inputs - False
Full Path - The "Microsoft.VisualStudio.ProjectSystem.References.UnresolvedBuildDependencyProjectReference" reference could not be resolved

I ran into the similar issue. In my case just closing the solution and opening it again fixed the issue.

Related

Trivial C++ code passes in a test project and fails in the main one

These two trivial lines of code:
const bool equal = (HUGE_VALF == HUGE_VALF);
static_assert(equal == true, "Fatal error");
in a test program work perfectly (no warnings and no errors).
When I copy them in the main project, I get this error on the assert:
error C2057: expected constant expression
Here the equal object is a constant with value = true.
Those lines of code are in both cases inside functions.
The two projects have identical settings (C++11, Visual C++ 2013 compiler, Visual C++ 2019 IDE, /W4, no optimizations).
What could be the reason of this different behaviour from the compiler?
When a newer Visual Studio IDE (like VS 2019) loads an older project for the first time, it asks to retarget the project. If You have the old Visual Studio installed, You can reject this action. Then the compiler from the original VS will be used by the newer IDE.
After loading the solution, in the Solution Explorer next to the project name, You will have the Visual Studio which will be used to compile the project.
If the paranthesis is missing, that means the compiler and standard library from the current Visual Studio is been used.
As mentioned in the comments:
I have no parenthesis after the project name (if I am looking in the right place). However, I realised about the issue in the include file paths: Test Project: 14.24.28314\include\cmath; Main Project: Microsoft Visual Studio 12.0\VC\include\cmath, i.e. a much older version, that internally still relies on the C math.h header. So, same compiler (VS2013), different libraries...
This indicates that You have most probably retargeted the project or created a new project in VS 2019.
To make a project in VS 2019 make use of the older compiler, You need to got to the project Properties -> Configuration Properties -> General -> Platform Toolset and change it to the appropriate Visual Studio.
Also make sure that all configurations (Debug, Release,...) for all machine types (32bit, 64 bit) have this setting the same value.
Because the test project is using VS 2019 - it has all the required definitions - so it works.
So the issue is that most probably, VS 2013 standard library is not C++11 complete and does NOT have a definition for HUGE_VALF.
But it could contain a definition for HUGE_VAL

Visual Studio 2017 can't find windows.h

Hell'o
I've just installed Visual Studio 2017 (enterprise).I opened my project whom I created in Visual Studio 2015. My project uses windows.h library but VS2017 cannot find this library. How to repair this?
My solution was :
Open the project properties
Into General --> SDK Version
I just picked the 10.0.15063.0 version instead of 8.1
And it worked.
I solved this issue by re-running the Visual Studio Installer and selecting the "Modify" button. Once presented with the Workloads screen I clicked on the "Individual Components" tab and selected all of the latest "Windows 10 SDK" Checkboxes(version 10.0.15063.0). My guess is that the entry for "Desktop C++ x86 and x64" is the one the actually fixes it but it is only speculation because none of those options were checked when I ran the installer and as you can see I checked all of them.
This happens when you have customized include/library paths in legacy projects. If you added your own additional paths in project properties, VisualStudio 2017 can't automatically figure out base paths when switching between platforms/toolsets - normally it automatically puts correct paths there, but if you added customizations, VS won't touch them.
This is legitimate problem which I ran into myself recently when migrating old project targeted for Windows XP into VS2017. None of the answers or comments listed/linked here so far are helpful. I have all legacy SDKs in VisualStudio 2017 installer, and none of that fixed VS not finding essential includes such as <windows.h>. In my case the project was using v120 toolset from VS2013, which is superseded by v140_xp in newer VS.
After setting correct platform and toolset understood by VS2017, I did the following to resolve the problem:
Open project properties, go to VC++ Directories, for 'Include Directories' and for 'Library Directories', choose <Inherit from parent or project defaults>. This will remove your additional paths.
Click 'Apply'. This will reset include path to something like $(VC_IncludePath_x86);$(WindowsSdk_71A_IncludePath_x86) (will vary for SDKs).
Re-add your extra paths here, or better yet - under C/C++/General -> Additional Include Directories and Linker/General -> Additional Library Directories.
I got it fixed when I simply changed "General => Windows SDK version" to a different version, submitted the changes and then changed it back.
The problem occurs when you migrate your C++ project from a more updated visual studio version to a lesser one.
To solve the issue simply go to your :
Project's properties-->General-->SDK Version [and here unroll to show installed SDK versions so you downgrade to an available version {Since the required one seems unavailable hence the error}].
Once one of the Available SDKs selected, Apply, and go back to your code, and everything gonna get fixed.
If the installation was ok it should be here:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\Windows.h
So be sure it is on the include path of the project properties.
Or if you prefer by manual edit in the .vcxproj file at the IncludePath Tag line:
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;</IncludePath>
TL;DR: make sure the checkbox, marked below, is checked.
In the Include Directories Dlgbox, there's an option at the bottom "Inherit from..." that needs to be checked. Somehow it got unchecked after moving a project to a different solution.
So, in my case, resetting to defaults and adding custom paths again wasn't even needed.
You have to go in Visual Studio 2017 Installer, choose Individual Components, and manually select and install Windows 8.1 SDK.
This step work for me.
1. Open visual studio installer
2. at menu "Visual studio comunity 2017" --> click modify
3. at desktop development with c++ --> enable windows10 SDK for desktop and windows 8.1 SDK
4. click modify
I've also installed Visual Studio 2017 (community) first with the default composition settings.I opened my project whom I created in Visual Studio 2015. My project uses windows.h library but VS2017 cannot find this library and other problems. At first I install the missing (SDK 10 ... etc.) components. Part of problems is gone, but windows.h still not found. The problem was solved by completely uninstalling VS2017 and then installing with all the options at once.
My solution was checking paths.
Include Directories:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;
%(AdditionalIncludeDirectories)
Library Directories:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64
and then right click Solution Explorer: Solution 'xxxxx' (1 project) line click "Retarget solution"
Remember to set Debug setting for Symbols fetch - Windows 10 must use Microsoft symbol server!

Cannot add Static Lib (C++) as a Reference due to targeting different platforms

I'm experienced w/C# and C, but not with C++. I need to interface to an API in C / C++, so I'm off to learn C++ with Visual Studio 2015 Pro.
I built a very simple example to test the library of classes (as a static library) being used in a console application for testing.
I cannot add my library as a reference because VS 2015 claims that they target different platforms. However, the properties indicate the same platform.
What is this error telling me that I don't understand?
I'm using Visual Studio 2015 and doing something similar.
I had the same problem and I think what happened was maybe I chose the "static library" project and "executable" project from different submenus in the Visual Studio project creation wizard.
I went back through the project creation wizard and made sure I selected an executable type from the same category as my static library (in my case, "Universal Windows"). That platform setting is shown in parentheses after the Project name and seems to be different than the SDK settings the error seems to refer to.
I was looking for a way to "convert" my project from "Visual Studio 2010" (its original setting somehow) to "Universal Windows" but I haven't found one yet. I tried using Solution Explorer's "Retarget solution" option (in the right click context menu for the solution) but all it did was get me off Visual Studio 2010 and onto something that didn't have a reference at all. So I made a new project and copied the files over into it.

Visual Studio 2012 using platform toolset v100. Cannot open source file "atlbase.h"

I am using Visual Studio Ultimate 2012. I have a project that works when i use the default v110 platform toolset.
Now I would like to add the Point Cloud Library (PCL) to this project to further work on it. Unfortunately there are only binaries available for Visual Studio 2010. I first tried to compile the 2012 binaries myself but that turned out to be more trouble than its worth. So i changed my platform toolset to v100 in order to use the PCL prebuilt binaries.
However, when doing so, one of my includes (atlbase.h) is no longer recognized. I have tried to manually include this by adding the Include and Library Directories of ATL in the project properties. This generated a whole lot of new errors, originating from the atl header files, which seems odd. I have also tried changing the option "Use of ATL" to "Dynamic Link to ATL" and "Static Link to ATL" from the default "Not Using ATL" to no avail.
I'm working on a 64 bit Windows 7 Ultimate machine and want to compile in 32 bit.
Edit: Using Process Monitor I have found that Visual Studio is looking for the include file in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlbase.h.
This folder (..\atlmfc) does not exist.
My VS2012 is installed at D:\School Programs\Visual Studio 2012
Is there a fix for this?
When you Switch to another different toolset this complete toolset must be available. This includes also the header files.
It should be possible without great Trouble to convert this DLL into VS 2012. Or myabe you can include the complete source without using a separate DLL.
Download and install WDK 7.1 (microsoft.com/en-us/download/confirmation.aspx?id=11800)
Create an environment variable which points to the installation directory, I called mine WINDDK
Go to project Properties -> VC++ Directories
Add $(WINDDK)\inc\atl71 to Include Directories
Add $(WINDDK)\lib\ATL\i386 to Library Directories (this is for 32 bit)
Go to project Properties -> Linker -> Input
Add atl.lib to Additional Dependencies
These steps have solved my problem

"Cannot update project reference" error introduced by Visual Studio 2012

I had a command line build which was working fine with Visual Studio 2010.
I am now trying the same solution with Visual Studio 2012.
When I build it via the command line:
devenv MediaPlayer.sln /build "Release|Any CPU"
I get a pile of errors with the website:
37>------ Build started: Project: C:...\Web\, Configuration: Debug
Any CPU ------
37>Cannot update project reference ''. Source project
not available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Validating Web Site
But then I open the SAME solution in Visual Studio 2012, and build it. It builds.
I then run this same build via the command line, and it builds.
So I check it in, and let the build process fetch it into the build directory, and I get THE SAME ERRORS.
At this point, I'm stumped as to what to do next. Any pointers?
When the Visual Studio 2012 build output says
Cannot update project reference
It's actually saying
Something went wrong, and you know what?
I'm not going to tell you what it is!
BWAHAHAHAHAHAHAHAHAHAHAHAHA
After a full days search, it came down to a third party library (Castle.Windsor.dll) not being in the .bin directory. I don't know why this problem showed up with Visual Studio 2012 and not Visual Studio 2010. My guess is that in Visual Studio 2010, this was automatically copied over because it was a dependency of another project the website was dependent on.
I manually created a .refresh file for Castle.Windsor.dll and Castle.Core.dll, and now it builds.
I also experienced this same error when trying to build a solution in VS 2012.
I had a solution that I upgraded from VS 2010 to VS 2012 and then started removing some long dead projects. VS 2012 became "confused" with this removal and deemed that a website project in the solution needed a reference to '', which was not available.
To resolve this, I undid the above mentioned changes to the solution, opened it up in VS 2010, removed the long dead projects and built successfully and then closed VS 2010. I was then able to open/update the solution in VS 2012 and work without issue.