kskrygan
kskrygan

Reputation: 11

How to obtain my vsix extension's folder and use this value to insert in some project template's files?

My VSIX extension has project templates with custom project file. This file contains a reference to my .targets file which is installed as a part of VSIX extension (so it's in my extension's folder). My problem is that I can't find any variable that indicates the VS extensions path, which is needed to find a target for the projects file.

If there is still something like:

<Import Project="$(VSExtensionsPath)\MyCompany\MyExtension\MyLang.targets" />

that would be great.

If not, is there any other way? Maybe I can run a script during vsix installation?

Upvotes: 1

Views: 918

Answers (2)

dus Exo
dus Exo

Reputation: 31

<Import Project="$([System.IO.Directory]::GetFiles($([System.IO.Path]::Combine($([System.Environment]::GetFolderPath(SpecialFolder.LocalApplicationData)), `Microsoft\VisualStudio\11.0\Extensions`)), `Your.targets`, System.IO.SearchOption.AllDirectories))" />

Upvotes: 1

Aaron Marten
Aaron Marten

Reputation: 6568

No, custom MSBuild targets aren't supported in VSIX in VS 2010. There is no way to do a "custom action" during VSIX install time.

One possible solution (may not be good for your situation though) would be including the targets directly in the project file template.

If this isn't feasible, then unfortunately you won't be able to use VSIX to deploy your extension.

Upvotes: 0

Related Questions