1. Install the component visual studio installer: expand and update --> online --> search
2. Create a project: File -> New -> Project -> Other Types -> Setup Project
3. Edit: Project->view->file system
key diagram
4. Build: Project -> Build
5. Test: Project -> Install | Uninstall
Note:
The non-empty resource directory cannot be deleted directly, it can be realized by the following c++ function code
bool removeSetupBuilderDir(std::string path/*=xxx..vdproj*/, std::string tag/*= /dirname/*/)
{
std::fstream file(path, std::ios::in);
if (file.is_open()) {
std::string line;
std::vector<std::string> lines;
bool isFind = false;
while (std::getline(file, line)) {
std::cout << line << std::endl;
std::string::size_type pos = 0;
if ((pos = line.find(tag, pos)) != std::string::npos) {
lines.erase(lines.end() - 1);
lines.erase(lines.end() - 1);
isFind = true;
continue;
}
if (!isFind)
{
lines.push_back(line);
}
else
{
if (*(line.end() - 1) == '}') {
isFind = false;
}
}
}
file.close();
file.open(path, std::ios::out | std::ios::trunc);
for (const auto& i : lines) {
file << i << std::endl;
}
}
return false;
}