开发者

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

开发者 https://www.devze.com 2023-01-18 21:59 出处:网络
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 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 an开发者_StackOverflow社区y other way? Maybe I can run a script during vsix installation?


<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))" />


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消