I want to programmatically install a folder in Visual Studio's "Extensions" folder. The closest i can get is using the VS100COMNTOOLS environment variable. What i want to do is go back one level from the "Tools" folder, the go into IDE/Extensions, something like VS100COMNTOOLS..\IDE\Extensions. This is my code:
namespace TemplatesCustomAction
{
public class CustomActions
{
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
var vspath = Environment.GetEnvironmentVariable("VS100COMNTOOLS");
session["VSINSTALLATIONFOLDER"] = string.Format(@"{0}\..\IDE\Extensions", vspath);
return ActionResult.Success;
}
}
}
Use Path.GetFullPath
:
var pathWithParent = string.Format(@"{0}\..\IDE\Extensions", vspath);
session["VSINSTALLATIONFOLDER"] = Path.GetFullPath(pathWithParent);
Though I'd also rather use Path.Combine
:
var pathWithParent = Path.Combine(vspath, @"\..\IDE\Extensions");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With