Installation

Download the .msi from AppConfig Code Generator 1.3.1.0 and double-click on it.
If a previous version is installed on the computer, unsinstall it before.

Use

C#

Set the Custom Tool property of the app.config file to "AppConfigCodeGenerator".



VB.NET

Set the Custom Tool property of the app.config file to "AppConfigCodeGeneratorVB".
Set the Custom Tool Namespace.
I don't know why but the generated file is not added to the VB.NET project. If anybody has an idea...



Default value

The application handle default values for appSettings:

<add key="myAppSettings" value="myValue" default="defaultValue" />

or

<add key="myAppSettings" value="myValue" default="" />

Of course, the default attribute is not mandatory.

Type definition

The application handle type definition for appSettings;

<add key="myAppSettings" value="1" type="int" />

String if the default type.

The following types are supported:
  • bool
  • char
  • datetime
  • decimal
  • double
  • float
  • int
  • uint

The type can be an array:
  • bool[]
  • char[]
  • datetime[]
  • decimal[]
  • double[]
  • float[]
  • int[]
  • uint[]

You can use the default and type features in the same appSetting line.

Warning
In order to use the default and/or type features, you have to modify your project file:
Add this line in the .csproj/.vbproj file:

<UsingTask TaskName="AppConfigCodeGenerator.AppConfigCleanTask" AssemblyName="AppConfigCodeGenerator, Version=1.2.1.0, Culture=Neutral, PublicKeyToken=8ca6685cbc7f7a26"/>

Then add this line:

<AppConfigCleanTask FileName="$(TargetPath).config" />

In the following tag:
<Target Name="AfterBuild">
</Target>


This lines indicates a MSBuild Task to use. This task just remove the default attribute in the [ApplicationName].config file in the output directory, otherwise the file can't be used.

Last edited Apr 9, 2011 at 3:39 PM by laedit, version 4

Comments

No comments yet.