Wednesday, August 12, 2009

Use Custom Objects in Project Settings

 

1.Add a new setting, set the name and one of displayed types.

2.Inside your VS.Net open the Settings with the Xml Editor.

3.Locate your new setting:

<Setting Name="ReplaceSomething" Type="System.String" Scope="Application">
        <Value Profile="(Default)">            
        </Value>
    </Setting>

 

4.Edit the Type attribute in my case, i changed to:

<Setting Name="ReplaceSomething" Type="RegExHttpModule.RegExReplaceRule" Scope="Application">
        <Value Profile="(Default)">            
        </Value>
    </Setting>

5.And now place the Xml Serialization version of the object:

<Setting Name="ReplaceSomething" Type="RegExHttpModule.RegExReplaceRule" Scope="Application">
        <Value Profile="(Default)">           
            &lt;RegExReplaceRule xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
            &lt;UrlRegularEx&gt;1&lt;/UrlRegularEx&gt;
            &lt;FileContentRegularEx&gt;2&lt;/FileContentRegularEx&gt;
            &lt;FileContentReplace&gt;3&lt;/FileContentReplace&gt;
            &lt;/RegExReplaceRule&gt;
        </Value>
    </Setting>

6.Now you can close de Xml Editor and click over the Settings file.

No comments: