Visual Studio 2012 multiple project template with inter-dependencies -
i'm in process of creating mvc starterkit work , i'm having problems creating multi-project template doesn't require massive manual modification after creation.
what have 4 projects have dependencies on each other:
- starterkit.common - no dependency
- starterkit.dal - dependency starterkit.common
- starterkit.bl - dependency starterkit.common , starterkit.dal starterkit.web - dependency other three
i've tried going route of exporting each project using export template wizard, creating root .vstemplate file , zipping up. although works (i can create new solution based on template), has serious problems.
firstly, export replaces entire namespace of each project $safeprojectname$, i.e. starterkit.dal => $safeprojectname$, starterkit.web => $safeprojectname$ etc.
this means when new project created (let's call xxx), in namespace starterkit.web ends in xxx namespace , starterkit.bl also ends in xxx namespace!
this not going work.
secondly, using statements not replaced @ all. example using starterkit.common;
not replaced in web project because doesn't have correct namespace (which starterkit.web).
thirdly, have .tt scripts contains using statements want replace, though set replaceparameters="true"
in project, these not touched @ all.
i looked creating vsix project, frankly don't see how can use that. me looks zip utility creates .vstemplate , renames .zip .vsix me.
what need is:
- package projects in single deploy file available "new project" template in vs
- when newproject created, replace "starterkit" namespace references in .csproj, .cs, .cshtml , .tt files whatever user selected solution name
- figure out simple process can update templates whenever base projects change (files added/removed, renamed, content changed etc)
does have idea if possible?
full disclosure: creator of below mentioned project.
you can achieve desired result using iwizard
implementation created called globalparams
. makes information solution template level available child templates run wizard prefixing all solution level parameters word global , adding them parameters of child template.
if used globalparams above multi-project template , user entered "starterkit", following true:
- starterkit.common access
- $safeprojectname$ = starterkit.common
- $globalsafeprojectname$ = starterkit
- $globalguid1$ = e8c8a064601844439909d6c33ab90cb3
- $globalguid2$ = 020db5abf76040c7bda19eac54dfe3d8
- $globalguid3$ = 8392fb760f754c0ab87778845cc28b6d
- $globalguid4$ = 13e07d43f523467587296b2c386dee50
- starterkit.dal
- $safeprojectname$ = starterkit.dal
- $globalsafeprojectname$ = starterkit
- $globalguid1$ = e8c8a064601844439909d6c33ab90cb3
- $globalguid2$ = 020db5abf76040c7bda19eac54dfe3d8
- $globalguid3$ = 8392fb760f754c0ab87778845cc28b6d
- $globalguid4$ = 13e07d43f523467587296b2c386dee50
- starterkit.bl
- $safeprojectname$ = starterkit.bl
- $globalsafeprojectname$ = starterkit
- $globalguid1$ = e8c8a064601844439909d6c33ab90cb3
- $globalguid2$ = 020db5abf76040c7bda19eac54dfe3d8
- $globalguid3$ = 8392fb760f754c0ab87778845cc28b6d
- $globalguid4$ = 13e07d43f523467587296b2c386dee50
- starterkit.web
- $safeprojectname$ = starterkit.web
- $globalsafeprojectname$ = starterkit
- $globalguid1$ = e8c8a064601844439909d6c33ab90cb3
- $globalguid2$ = 020db5abf76040c7bda19eac54dfe3d8
- $globalguid3$ = 8392fb760f754c0ab87778845cc28b6d
- $globalguid4$ = 13e07d43f523467587296b2c386dee50
with globalparams
have access 100 guid
s global prefix same across child templates. starterkit.common project can given value of "$globalguid1$" project id starterkit.dal , starterkit.bl building project references starterkit.common using "$globalsafeprojectname$.common" name of project being referenced , "$globalguid1$" id of project being referenced. think can see how work building references between rest of projects.
Comments
Post a Comment