-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MSBuild] vcpkg not respecting Visual Studio project properties #27906
Comments
I can't reproduce this on a simple example. Here's the project that I'm experiencing this on: https://github.com/nikitalita/papyrus-debug-server/tree/wip-modernize This is not a simple project configuration; the vcpkg.json and solution are in the root, and the main projects point to the same codebase, but with different DEFINES set for different pragmas. This might be why |
I figured it out the conditions that this happens under. The issue is that Visual Studio 2022 will sometimes add the PropertyGroups containing the vcpkg properties AFTER Visual Studio seems to add PropertyGroups after the last PropertyGroup in the project file, and there was one in mine that was located after the targets import. Either way, I am not sure that anything can be done here on vcpkg's end; this sounds like a bug in Visual Studio or MSBuild. |
@nikitalita Thank you for submitting the issue. For VS integration, vcpkg provides these two files : vcpkg.props and vcpkg.targets to preset some parameters. You can reload the configuration file by modifying the |
We hope your question was answered to your satisfaction; if it wasn't, you can reopen with more info. |
see: microsoft/vcpkg#27906 (cherry picked from commit 683c525)
FWIW I ran into this issue today adding vcpkg in manifest mode to an existing large project and, after much searching and pulling out most of my hair, this was the only fix that worked. |
Describe the bug
vcpkg does not respect project properties set in Visual Studio 2022. This seems to be because they are already overridden before they are inherited.
As near as I can figure out, this only affects certain projects, and it seems to be a limitation of current MSBuilds; Property groups invcpkg.targets
are sometimes evaluated before the project configuration properties are inherited for the build target. I think you may have to create a task to create these overrides instead of doing them in root.Edit: I figured out the conditions where this happens, see below: #27906 (comment)
This is a huge problem for manifest builds, because if we are in manifest mode, we should install the packages to
$(VcpkgManifestRoot)\vcpkg_installed
by default, but since we don't read the properties before_ZVcpkgInstalledDir
is overridden, we install to$(VcpkgRoot)\installed
. You can't fix it by settingVcpkgInstalledDir
, because that only gets read into_ZVcpkgInstalledDir
if it's not set, and it's already set by the time the project properties are inherited.You can test this yourself by putting the following in
vcpkg.targets
:Environment
To Reproduce
Steps to reproduce the behavior:
vgpkg integrate install
Failure logs
Example config:
Example logs:
The text was updated successfully, but these errors were encountered: