Support non top-level root namespaces in item templates #918
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes the following issue reported on dev community: https://developercommunity.visualstudio.com/t/vsix-does-not-correctly-provide-rootnamespace-and/1153008
To achieve this, I had to write a custom template wizard so that I'm able to inject a custom root namespace replacement string with the dots replaced by
::. The code was basically 1:1 taken from https://github.com/NuGet/NuGet.Client/blob/7e3b0e445edecbdb6c46895ee4375cf834f45d87/src/NuGet.Clients/NuGet.VisualStudio.Interop/TemplateWizard.cs, so the automatic package installation that happens when first using the template should still work.The custom template wizard could enable better support for custom scenarios in the future as well, for example nested folders vs dotted prefix conventions for namespace hierarchy.
To make this correctly light up in the VSIX, some infrastructure work on the MS side will be required to strongly sign the
Microsoft.Windows.CppWinRT.dllfile, since otherwise VS refuses to load it.The assembly version is
0.0.0.0because it's carried around by the VSIX so there's no need to bind specific versions (the NuGet template wizard DLL already doesn't for example), but if desired this could most likely be updated to use proper versions.Some changes where made to the
.csprojfile to enable a better inner loop (now runningbuild_vsix Debug, opening the solution in VS and hitting F5 should "just work" to get the extension installed in the experimental instance).