Reputation: 2591
Is there an easy way to include a whole folder as content in a VSIX package? Hopefully there is an easier way than setting the "Include in VSIX" flag for each file separately.
The reason why we need this, is to add a compiled html help page (with a lot of dependency files) to our extension.
Upvotes: 0
Views: 2078
Reputation: 9334
As an extra idea to the answer above: since .vsix
is a regular .zip
, you can unzip it, put your files inside, zip it back and rename into *.vsix
- this will still work as a regular VSIX installer.
So the entire solution for building a vsix
installer with additional files (e.g. output of other solution builds):
Resources
to your vsix
projectProperties
window: BuildAction = Content
Inclide in VSIX = True
<Content Include="Resources\*.json">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\*.dll">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\*.exe">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
Put any dummy file with each extension (each mask mentioned in csproj) into this folder - so VS will understand that related option in csproj
is not a broken/dummy string and will not ignore files with this extension later
Build the VSIX solution
Grab myproj.vsix
file
Rename it into myproj.zip
, unzip
Copy any files you need (with extensions/masks mentioned in csproj
file) into Resources
folder
Zip all the stuff back into myproj.zip
, rename it into myproj.vsix
There you go: VSIX installer with a bunch of additional files needed for your installation. Install it.
Put your VS version into this path and go there:
cd %AppData%\Local\Microsoft\VisualStudio\14.0\Extensions\
3xg44004asdf
and check Resources
subfolder contents - your files are there. Except files/file masks not mentioned in csproj even if they exist inside VSIX installer.This scenario can be useful for building extensions for internal needs with TeamCity-like runner:
Upvotes: 1
Reputation: 77006
Is there an easy way to include a whole folder as content in a VSIX package? Hopefully there is an easier way than setting the "Include in VSIX" flag for each file separately.
You can use wildcard *
to include all the files under the folder as content into the VSIX package, like:
<Content Include="TestFolder\*.*">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
After build the VSIX project, change the generated file .vsix
to .zip
and unzip it, we will find all the files in the TestFolder
.
Hope this helps.
Upvotes: 2