ligershark / template-builder

This project will output a NuGet package which can be used to help create Visual Studio Item Templates and Project templates
Other
42 stars 28 forks source link

Added Preview Image Ignored File #75

Closed RehanSaeed closed 9 years ago

RehanSaeed commented 9 years ago

Added a new ignored file to support preview images called sw-file-previewimage.png, following the convention from sw-file-icon.png.

sayedihashimi commented 9 years ago

Thanks @rehansaeed have you tried it with a pattern like sw-* to see if that works? I'd like to find a general pattern that we can use here.

RehanSaeed commented 9 years ago

I've now done some testing. Adding this line removes the images from the generated project but the icons no longer appear in the VS New Project dialogue. You get the default project icon instead.

<ls-ProjectTemplateFilesToRemoveOnCopy 
    Include="_preprocess.xml;_Definitions\_project.vstemplate.xml;sw-file-icon.png;sw-file-previewimage.png;"/>

Removing sw-file-icon.png;sw-file-previewimage.png; or using sw-* as you suggested causes the icons to appear in the VS New Project dialogue but the files also appear in the generated project.

I also noticed the line below. I tried playing with it but it seems to have not effect. I haven't done much MSBuild for some time so I'm not sure what it does.

<!-- copy source folder to dest so that the files can be included in the generated vsix -->
<PropertyGroup>
  <ls-CopyExcludeStatement Condition=" '$(ls-CopyExcludeStatement)'=='' ">*.user *.suo project.lock.json _preprocess.xml sw-*icon.png *swexclude*</ls-CopyExcludeStatement>
...
sayedihashimi commented 9 years ago

@RehanSaeed

Removing sw-file-icon.png;sw-file-previewimage.png; or using sw-* as you suggested causes the icons to appear in the VS New Project dialogue but the files also appear in the generated project.

Ok thanks, that's what I was afraid of.

I also noticed the line below. ls-CopyExcludeStatement

I converted the copy from the template source to obj folder to use robocopy.exe to copy the files. That property contains the cmd line parameters to robocopy.exe for overall excludes like node_modules. We don't want to use that because that will prevent the files from going into obj which means they will not go into the template all together. We want them in the template but not in the .xproj file.

I was hoping we could get this to work w/o changes to the CreateTemplateTask but that doesn't look feasible. I think we can do the following.

I think this would be pretty easy to get added, if you agree do you think you could help? FYI making changes to TemplateBuilder sources and then testing that with SideWaffle is easy. Do the following.

To do a local end-to-end test using the nuget pkg generated from sources you can do the following.

Thoughts?

RehanSaeed commented 9 years ago

I have created a new pull request for the CreateTemplateTask enhancements (https://github.com/ligershark/template-builder/pull/78) and another for ligershark.templates.targets (https://github.com/ligershark/template-builder/pull/77).

Everything now seems to work, except Preprocess replacements seem to have stopped working.

RehanSaeed commented 9 years ago

Updated (https://github.com/ligershark/template-builder/pull/77) to remove _preprocess.xml from the robocopy which fixes replacements.

Everything seems to be working now :)

I will do some thorough testing this weekend before pushing out my ASP.NET 5 update to ASP.NET MVC Boilerplate.

sayedihashimi commented 9 years ago

@RehanSaeed I think we can close this since your other PR was merged. Let me know if I'm wrong here.

RehanSaeed commented 9 years ago

Excellent, Thank you!