Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I have a config.xml file I want to add to the VSIX file and have the file copied to the $(ApplicationData)\[company name] directory.
In the manifest editor in vs2010 I am adding a Content with the following parameters;
Content Type:  Custom Extension Type
Source: File .....\config.xml

My problem is I can't find the format, if one is allowed in the Add to subfolder field. I've tried things like;
$(AppData)\[company]\config.xml
%LocalAppData%\[company]\config.xml

but when I double click on the vsix file it creates the directory structure I specified in the Add to subfolder textbox in my development folder.

Or am I completely on the wrong path here and there's a better way?

[update]
I found that by setting the config.xml file properties;
Build Action: Content
Include in VSIX: True

that the file gets deployed to the extension folder but now I have the problem of pro grammatically finding the location of the extension folder.
[/update]

I see light at the end of the tunnel, lord I hope it ain't no train. :)

Thanks y'all
Posted
Updated 21-Mar-12 16:54pm
v2

1 solution

OK I found the solution. I found the following snippet

private static string RetrieveAssemblyDirectory()
{
    string codeBase = Assembly.GetExecutingAssembly().CodeBase;
    var uri = new UriBuilder(codeBase);
    string path = Uri.UnescapeDataString(uri.Path);
    return Path.GetDirectoryName(path);
}

After thinking about the solution it makes perfect sense, hence the palm slap to the forehead while muttering a duh sound.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900