简体   繁体   中英

Creating VSIX extension for a C++ project in a solution

Currently I have 2 separate solutions for my C++ project and for C# VSIX extension. I export my C++ project template as .zip archive, and in VSIX extension solution I add it as a file asset. Works fine, however I need to handle .zip manually all the time. To avoid that I've tried to merge the projects (C++ + VSIX) into a single solution, and instead of adding file asset I've tried to add project asset, selecting my C++ project. The problem is that doesn't work, VSIX project gives error when trying to compile it: "error MSB4057: no target "TemplateProjectOutputGroup"." and I haven't found anything describing how exactly must it be done.

VS2019 Community.

You really only need a single solution here that contains multiple projects.

The way I've done this in the past, was to first create an Empty .VSIX project (to be used for deploying the templates).

Then add new "C# Project Template" projects, and modify them to create a C++ project instead of a C# project. Note the core .csproj file still makes the Template Project C# project, but the templates payload (.vcxproj, .h, .cpp, etc are added, and the C# files removed. So that the end result is that the template produced a C++ project instead of a C# project.

These Project Template projects will generate .zip files, which can then be added to your .VSIX project, by first Referencing the Project Template projects (aka a Project to Project refernce), and then editing the vsixmanifest to include the output of the referenced project (the zip file) as an asset.

I wrote up a blog entry on this some years back, that does this. Though the focus was on the custom wizard used to set the Windows SDK Version, for the resulting C++ project created with the template. The code article also has a link to the source code, which you might find useful for additional guidance.

Creating a VSIX Deployable C++ project template

Sincerely,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM