Skip to content

VS/MSBuild per-project integration that "just works" #23366

Description

@davidmatson

Is your feature request related to a problem? Please describe.
I want to be able use vcpkg as a submodule and enable vcpkg in a vcxproj in Visual Studio without having to add any per-user prerequisites or extra per-repo setup steps.

Proposed solution
Update the vcpkg targets to support bootstrapping.

Describe alternatives you've considered
Requiring users to bootstrap manually, but that makes our repo harder-to-use than before.
Using the generated NuGet package via "integrate", but that adds a dependency on NuGet, which we're trying to minimize, and is not recommended via the docs.

Additional context
Here's an example workaround:

vcpkg_workaround.targets:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="VcpkgBootstrap" BeforeTargets="ClCompile"
            Condition="'$(VcpkgEnabled)' == 'true'"
            Inputs="$(_ZVcpkgRoot)bootstrap-vcpkg.bat"
            Outputs="$(_ZVcpkgExecutable)">
        <Message Text="Bootstrapping vcpkg" Importance="High" />
        <Exec Command="%22$(_ZVcpkgRoot)bootstrap-vcpkg.bat%22" StandardOutputImportance="High" />
    </Target>

    <Import Project="$(MSBuildThisFileDirectory)\vcpkg\scripts\buildsystems\msbuild\vcpkg.targets" />
</Project>

And then each project just something like:

    <Import Project="$..\vcpkg_workaround.targets" />

I imagine this question has come up before, but I couldn't find a current open issue tracking. Overall, my hope is that for folks who use VS without CMake, there can be a way to keep the repo self-contained and still "just work" when the project is opened/built for the first time.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions