web.{BuildEnvironment}.config.transform support

Oct 11, 2010 at 12:56 PM

I tried adding web.debug.config.transform and a web.release.config.transform to the content folder. Even though the resulting package contains these files, thery are not being deployed. Maybe this can be added on the feature list?

Oct 11, 2010 at 5:19 PM

Web.Debug.config and Web.Release.config are handled by VS at deployment time, and are not meant to be deployed themselves (please see this post).

Oct 12, 2010 at 12:21 AM

What about app.config transformations? (Think WPF, Windows Forms, Windows Service, Console App)

Oct 12, 2010 at 12:59 AM

Those would work if the file in the package is called app.config.transform, though we'll really want to address the issue of config changes generically without tying it to either web.config or app.config specifically.  i.e. we need a way to convey config changes that get applies to 'whatever is the right config file for the project'.

Oct 12, 2010 at 1:01 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Oct 12, 2010 at 1:03 AM

Agreed - that makes a whole lot more sense since the same package could be used for Web and non-web solutions.

Does NuPack have it's own transformation "engine" or is this connect issue relevant?
https://connect.microsoft.com/VisualStudio/feedback/details/564414

Oct 12, 2010 at 1:05 AM

It has its own engine, which is not as full featured, but much simpler to use.

Oct 12, 2010 at 6:05 AM

Thank you for the reply.

I understand that web.xyz.config is handled by VS during deployment, but I was thinking of delivering additional transformation content to these files during package install. For example, I created an internal repository with some packages that add a WCF service reference to the web.config. I would have like to add the config transformation xml for this web service to the web.{environment}.configs for different build environments as well.

Oct 12, 2010 at 6:09 AM

Can you describe exactly what happens when you tried that?  Are you saying that after installing the package into a project, those transformation files did not make it there?

Oct 12, 2010 at 6:35 AM

In the content subfolder from where the package is built, I created a file called "web.debug.config.transform". The target project does have a web.debug.config. Upon Add-Package, it outputs the following error:

 _WriteError : 'xdt' is an undeclared prefix. Line 7, position 17.
At C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\CodePlex Foundation\NuPack Tools\0.1\Scripts\nupack.ps1:107 char:24
+             _WriteError <<<<  $_.Exception
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,_WriteError

The web.debug.config.transform file contains the following:

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <system.serviceModel>
        <client>
            <endpoint
                address="http://devserver:8080/WebServices/Services/MyService.svc"
                bindingConfiguration="BasicHttpBinding_IMyService"
                xdt:Transform="SetAttributes"
                xdt:Locator="Match(bindingConfiguration)"/>
        </client>
    </system.serviceModel>
</configuration>

P.S. I tried the first element both with and without the xmlns attribute.

Oct 12, 2010 at 8:12 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.