Skip to content

Commit 53be6c3

Browse files
authored
fix(sdk): fix VsixTemplateReference path computation (#38)
Split the metadata computation into two ItemGroup updates because MSBuild cannot reference metadata that is set in the same update. Step 1 computes _ReferencedProjectDir and _TemplateFolderName. Step 2 uses those values to compute _FullTemplatePath and zip info. Closes #37
1 parent f8ccedd commit 53be6c3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/CodingWithCalvin.VsixSdk/Sdk/Sdk.Vsix.Templates.targets

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,17 @@
7070
<_ZipOutputPath>$(_VsixTemplateIntermediateOutputPath)ItemTemplates\%(VsixItemTemplate.TargetSubPath)</_ZipOutputPath>
7171
</VsixItemTemplate>
7272

73-
<!-- Compute paths for template references -->
73+
<!-- Compute paths for template references - Step 1: Get directory and folder name -->
7474
<VsixTemplateReference>
7575
<_ReferencedProjectDir>$([System.IO.Path]::GetDirectoryName('%(Identity)'))</_ReferencedProjectDir>
76-
<_FullTemplatePath>%(VsixTemplateReference._ReferencedProjectDir)\%(VsixTemplateReference.TemplatePath)</_FullTemplatePath>
7776
<_TemplateFolderName>$([System.IO.Path]::GetFileName('%(VsixTemplateReference.TemplatePath)'))</_TemplateFolderName>
77+
</VsixTemplateReference>
78+
</ItemGroup>
79+
80+
<!-- Step 2: Compute full path and zip info using metadata from Step 1 -->
81+
<ItemGroup>
82+
<VsixTemplateReference>
83+
<_FullTemplatePath>%(VsixTemplateReference._ReferencedProjectDir)\%(VsixTemplateReference.TemplatePath)</_FullTemplatePath>
7884
<_ZipFileName>%(VsixTemplateReference._TemplateFolderName).zip</_ZipFileName>
7985
<_ZipOutputPath Condition="'%(VsixTemplateReference.TemplateType)' == 'Project'">$(_VsixTemplateIntermediateOutputPath)ProjectTemplates\%(VsixTemplateReference.TargetSubPath)</_ZipOutputPath>
8086
<_ZipOutputPath Condition="'%(VsixTemplateReference.TemplateType)' == 'Item'">$(_VsixTemplateIntermediateOutputPath)ItemTemplates\%(VsixTemplateReference.TargetSubPath)</_ZipOutputPath>

0 commit comments

Comments
 (0)