How to add project reference to unmanaged c++ project from c++ custom project wizard?

  • Thread starter Thread starter BenWebb100
  • Start date Start date
B

BenWebb100

Guest
I currently have several unmanaged c++ project custom project wizards that were created for VS2008, I need to convert them to VS2015 projects. In VS2008, dependencies are set using "Build Dependencies". In VS2015, this is accomplished using references.

The default.js file was created by adding a new project to my solution using the Visual C++/General/Custom Wizard template. The Custom Wizard template allows me to create my own templates that can be used when adding a new project to my solution for the software I am developing. The templates I created worked correctly under VS2008. VS2015 will convert the existing projects from VS2008 to VS2015, however, I need to change from setting Build Dependencies (.sln is modified) to Adding References (.vcxproj is modified). The Custom Wizard template is the unmanaged C++ project equivalent of the managed languages Export Template functionality in VS.

Below is the js code that I used to set the build dependencies in VS2008. How do I add the references in the js code in VS2015?

My best guess is that there is a property or method to use on the project created in the CreateCustomProject in my default.js.

// default.js

function my_AddDllDependency(solution, projBD, strDepName)
{
try {
var depProj = my_FindProject(solution, strDepName);
if (depProj != null) {
projBD.AddProject(depProj.UniqueName);
}
}
catch (e) {
if (e.description.length != 0) {
wizard.ReportError("my_AddDllDependency Exception " + strDepName + " " + e.description);
SetErrorInfo(e);
} else {
wizard.ReportError("my_AddDllDependency Exception " + strDepName);
}
return e.number
}
}

function my_FindProject(solution, strProjectName)
{
try {
var oProj;
var i;

for (i = 1; i <= solution.Projects.Count; ++i) {
oProj = solution.Projects.Item(i);
if (oProj.Name == strProjectName)
return oProj;
}
}
catch (e) {
if (e.description.length != 0) {
wizard.ReportError("my_FindProject Exception " + e.description);
SetErrorInfo(e);
} else {
wizard.ReportError("my_FindProject Exception");
}
}
return null;
}


var solution = wizard.dte.Solution;
var projBD = solution.SolutionBuild.BuildDependencies.Item(proj);
my_AddDllDependency(solution, projBD, "tlBlockIO");

Continue reading...
 
Back
Top