Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically export a visual studio 2012 template

I'm wanting a way to 'automatically' export templates from Visual Studio 2012.

I'm aware you can do it manually by selecting File->Export Template and then fill out the wizard's questions for each project you have in your solution, but it takes a long time (typing... etc). I want to automate this in code.

I've spent quite a bit of time researching this to no avail; hence my question here!

Investigation 1: You 'could' do this with macros, however it is a bit ugly and not really professional. (How would you get the list of projects you have in your solution any way?)

Investigation 2: Apparently it is possible by tapping into the Visual Studio's automation objects; I can get at the function to export the project, however it only launches the Export Template Wizard resulting in you having to manually type in all the details anyway. See this link

Investigation 3: You can execute a file called 'Projectgen.exe', which helps the creation of the wizard's options (so you don't have to type them), however apparently it belongs to another company and, after contacting them, they were not willing to give me the file. (Not only that, it was designed for earlier versions of Visual Studio and calling an out-of-proc EXE is always not very nice) See this link

There was a similar question to this at Visual Studio 2012 - Export Template automation but no real answer.

There MUST be a cleaner way to do this! Id be happy to share what knowledge I have... Thanks!

like image 433
user2366165 Avatar asked Nov 13 '22 05:11

user2366165


1 Answers

I ended up creating a CodedUI recording and with some modifications I was able to automate the whole multi-project export process.

like image 72
ravinsp Avatar answered Dec 05 '22 01:12

ravinsp