How can I use MSBuild to export another project as a Visual Studio template project?

This is what I am trying to achieve. I have a number of projects in C # and VB that I want to export as templated projects as part of my auto build process. Exporting templates is easy to do interactively, but I need to do it as part of my auto build process. In addition, template projects must actually be created prior to exporting them so that they will be compiled when the end user uses the template. [I know that template projects do not usually compile, but I solved this problem, so for the purposes of this question, we can assume that template projects will compile successfully].

MSBuild, . , , , .

, , MSBuild, , , , MyTemplate.vstemplate, "walla", .

. , MSBuild noob, . , , .

I am painfully aware that this is almost a do-my-job-for-me question, my defense is that (a) this is not my job, and (b) I tried to do my MSBuild homework and the inspiration just doesn't flow.

+2


source to share


1 answer


In short, "do it for you" (), how about how I show you how it's done elsewhere? I just did the same on my own:

http://github.com/AArnott/dotnetopenid/commits



Specifically, the web project projecttemplates / WebFormsRelyingParty is converted to a project template using the buildProjectTemplates build.proj file.

My strategy is to have a regular (compiled) C # web project that I am working on. I also have a .vstemplate file in this folder that is not added to the project but is around so I can make changes. Then during my build, I have MSBuild, create a website, copy the result (excluding most of the website build products) to a temporary location. While copying, I have a custom MSBuild task that replaces my web app name $ safeprojectname $ in all source files, as this is what the VS Project Template Creator does. It also copies the icon to be used for the template. Finally, he zips it and places the .zip file in the output directory.

+2


source







All Articles