I have created a Visual Studio extension representing a Visual Studio Project wizard (vsix package). I am attempting to wire up log4net, and this has been unsuccessful. I have chased the issue down to my app.config not being loaded properly.
I have added this to my app.config in my visual studio extension:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="test" value="hello world"/>
</appSettings>
</configuration>
and within my IWizard implementation, I have added this line of code:
var test = System.Configuration.ConfigurationManager.AppSettings["test"];
However, the test
variable above is always null when debugging.
I have verified these things:
- App.config is set to Build Action: Content
- App.config is set to Copy to Output Directory: Copy Always
- App.config is set to Include in VSIX: True
- App.config file is present in my
C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\16.0_...\Extensions\<Name>\<Company>\1.0
folder
What am I missing? And if App.config is not allowed within VSIX extension development, how would you go about wiring up log4net?