Closed RehanSaeed closed 9 years ago
When I was updating the Add Template Reference feature for SideWaffle I had to programmatically adding the TemplateBuilder. This caused it to go into the 'dirty' state you mentioned in your first bullet. Since I already had an instance of the project (of type EnvDTE.Project currentProject) I was editing I just called the project save function. Maybe that can help you set it up to automatically save the project.
I was calling Save on the Microsoft.Build.Evaluation.Project
instead of EnvDTE.Project
. This was causing the 'something changed, do you want to discard your changes' dialogue to appear.
It seems to work now, thanks.
On your second bullet, If I'm not mistaken VB projects have the same file structure? I don't see it any problem with having it do the exact same thing for those projects. @sayedihashimi do you have any thoughts on this?
Yes I wasn't sure about whether I should even add this check. Apart from VB projects, there may be others? F# Maybe?
Perhaps we should remove this check it would be better to leave this decision up to the developer using the wizard. What's your opinion?
Thanks a lot for the PR. I don't see any value in excluding any project type. If the wizard is in the .vstemplate its opted in. At the end all projects are MSBuild/VS projects so no harm. For DNX there won't be any HintPath elements to update.
I'll review more this weekend and hopefully merge it.
Excellent. I get a surprising number of complaints from newbie developers about this problem.
Updated to remove the .csproj check.
@RehanSaeed thanks for the PR. I will do the following.
@RehanSaeed To make your wizard more general purpose I think it would be good to populate a new custom parameter `$NuGetPackagesFolder$ so that the token can be used to do replacements where the packages folder is needed. For an example of how to populate that token see https://github.com/ligershark/template-builder/blob/master/src/TemplateBuilder/RootWizard.cs#L15.
I did a fair amount of testing but I'm sure I haven't covered everything. I definitely haven't covered non-C# projects. Cool, so we won't have to add this wizard ourselves as it will be included by default.
So do you mean just sticking this at the end:
// relativePackagesDirectoryPath is the relative path to the NuGet packages from the project.
GlobalDictionary["$NuGetPackagesFolder$"] = relativePackagesDirectoryPath;
A wizard which fixes the hint paths for references to NuGet packages. This supports nuget.config files too using the NuGet.Core package. I also reference Microsoft.Build.dll to modify the project file.
I have done a fair amount of testing. with and without a nuget.config file. I have also tried using both relative and absolute paths in the nuget.config file. So far, it works well :+1: .
Possible Improvements