$rootnamespace$ in .transform file

Mar 15, 2011 at 2:33 AM

Hi all, i want to create a package with an HttpModule and a transform file.

I want the httpmodule in the namespace of the target project and I want the web.config.transform to include this module:

<configuration>
    <system.web>
        <httpModules>
            <add name="SessionPerRequest" type="$rootnamespace$.Infrastructure.SessionManagement.NHibernateSessionModule, $assemblyname$" />
        </httpModules>
    </system.web>
    <system.webServer>
        <modules>
            <add name="SessionPerRequest" type="$rootnamespace$.Infrastructure.SessionManagement.NHibernateSessionModule, $assemblyname$" />
        </modules>
    </system.webServer>
</configuration>

This doesn't work currently.

Mar 15, 2011 at 2:36 AM

You may want to take a look at the Elmah package which adds a module using the transform.

Mar 15, 2011 at 2:44 AM

I did, but it is not the same case, Elmah add two references to modules on the Elmah.dll:

 

    <httpModules>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
    </httpModules>

 

While the package i want to push, add the module class to the same project:

 

namespace $rootnamespace$.Infrastructure
{
   public class MyModule : IHttpModule
   {
      //...
   }
}

 

then i want to add to the webconfig:

<configuration>
    <system.web>
        <httpModules>
            <add name="SessionPerRequest" type="$rootnamespace$.Infrastructure.MyModule, $assemblyname$" />
        </httpModules>
    </system.web>
    <system.webServer>
        <modules>
            <add name="SessionPerRequest" type="$rootnamespace$.Infrastructure.MyModule, $assemblyname$" />
        </modules>
    </system.webServer>
</configuration>

I don't know the full-namespace of the module until the web.config is transformed.

Mar 15, 2011 at 3:45 AM

I don't think we support both kind of transforms (web.config transform and token transform) in the same file yet. I believe there was an issue logged for this.

Mar 15, 2011 at 3:56 AM

I did a quick search but couldn't find it. But then again, I can never find anything on the Issue system. It may not be tracked yet.

Mar 15, 2011 at 4:14 AM

I wonder if we should just say that .transform files *always* get the token replacement, instead of having authors ask for both (e.g. by using a .pp.transform extension). Are there any realistic scenarios in which doing the token replacement on the transform file would do unwanted things?

Mar 15, 2011 at 4:45 AM

It's here: http://nuget.codeplex.com/workitem/738

Mar 15, 2011 at 10:41 AM
IMO it is ok to do the replace always

2011/3/15, davidebbo <notifications@codeplex.com>:
> From: davidebbo
>
> I wonder if we should just say that .transform files *always* get the token
> replacement, instead of having authors ask for both (e.g. by using a
> .pp.transform extension). Are there any realistic scenarios in which doing
> the token replacement on the transform file would do unwanted things?
>
>

--
Enviado desde mi dispositivo móvil
Aug 19, 2011 at 2:50 PM

In the closed and verified notes for the associated bug fix http://nuget.codeplex.com/workitem/738 it says "when token is not found a clear error is given i.e. "Install-Package : The replacement token 'NotFound' has no value."" . . . is this just in the case where you used web.config.transform.pp to trigger token replacement as well as transform processing not knowing that you get both using just the default name web.config.transform?

Coordinator
Aug 19, 2011 at 5:25 PM

I don’t understand the question. I think you’re asking why we throw an error if you have a replacement token, but no value for the token?

The reason is that in most cases, that is an error such as a typo. If you have a replacement token, you should have a value for it.