문제

I have been using the "Build Deployment Package" (BDP for short) from visual studios 2010 for several months now. It works great and has done the basic requirements that we have wanted.

I decided to take it a step further and figure out how to get my custom configuration so it can be modified in the Project.SetParameters.xml file generated by the BDP. The way we use this is we build this deployment package, and deliver it to a customers server. Each server may be different, so we keep the SetParameters.xml on the server and just replace the zip file for upgrades later. We use the WebDeploy tool to deploy it with the supplied cmd file created by Build Deployment Package.

I started working on this transform web config which is quite cool, but I don't think I am totally getting it. I can get it to do items that are normal within the web.config (such as connection string, web server settings, etc), however I cant for the life of me get it to generate Parameters for config sections that are part of other DLLs included in the web.config. For example:

For example. say this is the web.config for a web project that references several other assemblies:

<?xml version="1.0"?>
    <configuration>
      <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <section name="SomeAssembly.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
      </configSections>
      <applicationSettings>
        <SomeAssembly.Properties.Settings>
          <setting name="ExportLocation" serializeAs="String">
            <value>C:\MediaExports\</value>
          </setting>
        </SomeAssembly.Properties.Settings>
        </applicationSettings>
    </configuration>

and my transformer is:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="SomeAssembly.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <SomeAssembly.Properties.Settings>
    <setting name="ExportLocation" value="[MakeMeSetParameter.xml-Entry]" serializeAs="String" xdt:Transform="SetAttributes" xdt:Locator="Match(value)"/>
  </SomeAssembly.Properties.Settings>

</configuration>

Sample project.xml (not from the above, but what is generated for my project):

    <?xml version="1.0" encoding="utf-8"?>
    <parameters>
      <setParameter name="IIS Web Application Name" value="SomeIISNameHere" />
      <setParameter name="SomeAssemblySetting-SomeDescriptionOddPlaceforit" value="TheValueToBePlaced" />
<setParameter name="SomeGeneratedValueIwant" value="TheNewMediaExportLocation"/>
    </parameters>

I cant figure out what to put in the transformer web.config to make it generate outputs for the Project.SetParameters.xml. "Tokenized" parameters.

Now, I know I am not fully understanding this, but I cant seem to find any examples of people using custom configurations for other assemblies that the project references. Almost all examples seem to relate to connectionstrings and other common web.config items.

Closest I could find to what I am trying to do was http://sedodream.com/2010/11/11/ASPNETWebApplicationPublishPackageTokenizingParameters.aspx however again its just about the connectionstrings, not custom settings parameters for other assemblies I want to set. I want to create these tokens for anything in the web.config.

So, my question is: how do we configure the transformer config file so that the BDP can generate the SetParameters.xml with additional setParameter nodes for custom configurations within the web.config?

도움이 되었습니까?
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top