Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Project Template Help #378

Open
Bobisback opened this issue May 10, 2016 · 5 comments
Open

New Project Template Help #378

Bobisback opened this issue May 10, 2016 · 5 comments
Labels

Comments

@Bobisback
Copy link

Hello All,

First off this is not a bug, I am just trying to figure out how to do something.

So I managed to get my mutiproject template up and running with the help of Sayed (Thanks man!) Now I am trying to setup my Project template I need that goes with this muti project template as well as a couple of item templates. First I wanna start with my Project template.

So I wanna create a project template that replaces certain things in the project, the issue is I am not sure how to get those things. I am thinking a custom wizard would work I am just not sure how to build one with Side Waffle. First off this project template will only be created in an existing solution (in fact it will only work with my muti project template.) So I need 3 parameters and I am not sure if I can get them from the project or if I need a wizard to get them.

  1. I need the root name space of the solution that this project is being added to. Aka if the solution is called Test10 I would need this as a parameter for replacement. There is a $rootnamespace$, but this does not seem to work for projects. This is really the only issue I am having right now, can I get the root name space for the solution or do I need a custom wizard for this?
  2. I need the name of the module. So I guess this would most likely be the name of the project. So for example if I am making the AttendanceModule I would need Attendance as a parameter replacement. I think I can just use $safeprojectname$ and make it clear in the description to call it the name of the module without Module on the end.
  3. I would need the module name with Module added to the end of it. Aka if the name of the module is Attendance then I would need AttendanceModule. I think i can accomplish this by using $safeprojectname$Module through out the project.

Below is an example of how I envision this to work. lets say I have a solution called MyProject. I would want to add a new project template called Example and this is what it should do.

Replaced values
MyProject (Solution name)
MyProject.Modules.ExampleModule (Project name)
ExampleModule.cs (File Name)
"Example Module" (String literal in the .cs file, not sure if this is possible)

Unreplaced Values
MyProject (Solution name)
$rootnamespace$.Modules.$safeprojectname$Module (Project name)
$safeprojectname$Module.cs (File Name)
"$safeprojectname$ Module" (String literal in the .cs file)

Is this even possible? If so what would I need to do to do something like this?

Thanks,
Bob

@Bobisback
Copy link
Author

Bobisback commented May 10, 2016

So I ended up creating a custom wizard to get the variables I need to build the project correctly.

Now I am running into two issues.

  1. I cannot rename any files. Aka if I use this:
    <ProjectItem TargetFileName="$modulenameshort$PageViewModel.cs" ReplaceParameters="true">ExamplepageViewModel.cs</ProjectItem>
    I get a error that the file is not found. And if I use the preprocess.xml I also get a error that the file was not found. Any ideas how I can create dynamic file names for my class's in my project template.
  2. The second issue I am having is with folders and references. The muti project template is created inside of a folder named after the solution name. This is where all the projects are stored. When I create my new project it puts the project in the root of the solution not in this folder where the other projects are. So all my references to the solution projects fail. if I put the project inside this solution folder then all my nuget package references fail but all my project solution references work. Any idea how I can either add a parent folder to the project template or change the references to point to the right packages folder?

Thanks,
Bob

@codewithtyler
Copy link
Member

@sayedihashimi any ideas?

@codewithtyler
Copy link
Member

@Bobisback were you able to figure out a solution to your issue?

@Bobisback
Copy link
Author

Bobisback commented Nov 9, 2016

@RandomlyKnighted Ya I found a solution. Give me a day or so to dig up all the info it, it was a bit in depth. If you do not hear from me in a couple of days hit me up again.

@codewithtyler
Copy link
Member

Sounds good, looking forward to hear your solution.

@sayedihashimi sayedihashimi removed their assignment Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants