Reputation: 63
I'm creating a template C++ project for Visual Studio that requires some .lib and .dll files. The files are linked to in the project properties linker settings and included in the dependencies and also included in the project via the Solution Explorer. Everything runs fine, but when I export the project to a template and use that template to create a new project the .lib files are the only ones missing.
I've tried extracting the .zip of the exported template, adding the .lib files manually and their paths to the .vstemplate, then re-zipping the project, but this hasn't worked either.
I'm using Visual Studio 2019 on Windows 10 if that's relevant.
Upvotes: 2
Views: 460
Reputation: 340
<ProjectItem ReplaceParameters="false" TargetFileName="main.cpp">main.cpp</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="glfw3.lib">DEPENDENCIES\GLFW\lib-vc2022\glfw3.lib</ProjectItem>
<ClInclude Include="Dependencies\GLEW\lib\Release\x64\glew32.lib" />
Now you will be able to create a new project from this template and it will include the .lib files
Upvotes: 0
Reputation: 1923
In my opinion, as mentioned in the link, the best way is to create a nuget package which contains all your 'content' - such as DLLs.
Of course, there is another way:
Create a Dependencies
folder under the project directory, put the required dlls and libs.
Set Proeperties->C/C++->General->Additional Include Directories->(SolutionDir)Dependencies\..
and Proeperties->Linker->General->Additional Library Directories->$(SolutionDir)Dependencies\..
in your project template.
Dependencies
folder to your new project directory.Upvotes: 1