diff --git a/toolsrc/src/commands_export.cpp b/toolsrc/src/commands_export.cpp
index 4c920d9621..1fff545bf6 100644
--- a/toolsrc/src/commands_export.cpp
+++ b/toolsrc/src/commands_export.cpp
@@ -30,9 +30,10 @@ namespace vcpkg::Commands::Export
-
-
+
+
+
)";
@@ -43,6 +44,15 @@ namespace vcpkg::Commands::Export
return nuspec_file_content;
}
+ static std::string create_targets_redirect(const std::string& target_path) noexcept
+ {
+ return Strings::format(R"###(
+
+
+
+)###", target_path, target_path);
+ }
+
static void print_plan(const std::map>& group_by_plan_type)
{
static constexpr std::array order = { ExportPlanType::ALREADY_BUILT, ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT };
@@ -86,7 +96,7 @@ namespace vcpkg::Commands::Export
const size_t bytes_written = std::strftime(mbstr, sizeof(mbstr), "%Y%m%d-%H%M%S", &date_time);
Checks::check_exit(VCPKG_LINE_INFO, bytes_written == 15, "Expected 15 bytes to be written, but %u were written", bytes_written);
const std::string date_time_as_string(mbstr);
- return ("vcpkg-exported-" + date_time_as_string);
+ return ("vcpkg-export-" + date_time_as_string);
}
static fs::path do_nuget_export(const VcpkgPaths& paths, const fs::path& raw_exported_dir, const fs::path& output_dir)
@@ -280,6 +290,10 @@ namespace vcpkg::Commands::Export
Checks::check_exit(VCPKG_LINE_INFO, !ec);
fs.copy_file(paths.buildsystems / "vcpkg.cmake", raw_exported_dir_path / "vcpkg.cmake", fs::copy_options::overwrite_existing, ec);
Checks::check_exit(VCPKG_LINE_INFO, !ec);
+ const std::string targets_redirect_content = create_targets_redirect("msbuild/vcpkg.targets");
+ const fs::path targets_redirect = raw_exported_dir_path / "vcpkg.targets";
+ fs.write_contents(targets_redirect, targets_redirect_content);
+ Checks::check_exit(VCPKG_LINE_INFO, !ec);
if (raw)
{