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

Added Preview Image Ignored File #75

Closed
wants to merge 1 commit into from
Closed

Added Preview Image Ignored File #75

wants to merge 1 commit into from

Conversation

RehanSaeed
Copy link
Contributor

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

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

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
Copy link
Contributor Author

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
Copy link
Member

@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.

  • Update the CreateTemplateTask to have a new property ExcludeFilesRegex in which we can give a regular expression that can be used to exclude files. We should default the value of that property to something like sw-.* so that we can easily exclude files.
    By creating this as a property if we need to override the default we can do that in the .targets file.

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.

  • Clone TemplateBuilder and SideWaffle locally
  • Make your changes to TemplateBuilder
  • Build TemplateBuilder from the command line using build.ps1
  • Execute build.ps1 -setMSBuildOverrides. This will set two MSBuild properties to redirect MSBuild .targets and task to the build outputs of the sources

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

  • Create a new folder c:\temp\nuget\localrepo
  • Run build.ps1, which should copy the build .nupkg to c:\temp\nuget\localrepo
  • In VS create a NuGet package source to c:\temp\nuget\localrepo and use that to install the latest package

Thoughts?

@RehanSaeed
Copy link
Contributor Author

I have created a new pull request for the CreateTemplateTask enhancements (#78) and another for ligershark.templates.targets (#77).

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

@RehanSaeed
Copy link
Contributor Author

Updated (#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
Copy link
Member

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

@RehanSaeed
Copy link
Contributor Author

Excellent, Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants