What is the expected contents of Web.config if appSettings entry is parameterized?

StackOverflow https://stackoverflow.com/questions/22393058

  •  14-06-2023
  •  | 
  •  

سؤال

I'm trying to parameterize an appSettings entry in my Web.config. Since this is a part of a quite long build process, I'd like to verify that my parameterization actually works before trying it out on our CI server (i.e. trial and error is not a good idea).

So, if I run MSBuild with /T:Package to create my package, I expect that the .zip file created would contain a Web.config with my appSetting entry tokenized, just like a connection string is tokenized.

But, so far I do not get my expected result. Is my assumption wrong? Is it maybe that the tokenization/replacing happens first in the actually deploy-step?

Here's the tokenized web.config. Notice how my appSetting isn't tokenized:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <lots of stuff here...>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="$(ReplacableToken_DefaultConnection-Web.config Connection String_0)" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="mySetting" value="monkey"/> <!-- Shouldn't monkey this be tokenized? -->
  </appSettings>
  <rest of web config here ...>
هل كانت مفيدة؟

المحلول

The con string tokenization is taken care of in the web publishing MSBuild targets. It's not a part of Web Deploy itself. In your scenario I'd expect that the package was created and app settings are not modified.

When the package is created there are two ways you can see the parameters:

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top