Custom versioning files configuration

This configuration shows how to configure MakingWaves.Common and add versioning files in exists application.

Add MakingWaves.Common.Web to solution

Remember that Nuget manger should be updated. In other cases packages could not be loaded (package source: http://nuget.makingwaves.no/nuget)

Add configuration to web.config

<configSections>
    <section name="makingWaves.common.web" type="MakingWaves.Common.Web.MakingWavesCommonWebConfigurationSection, MakingWaves.Common.Web" />
    <section name="makingWaves.common" type="MakingWaves.Common.MakingWavesCommonConfigurationSection, MakingWaves.Common" />
</configSections>

<assemblyBinding>     
      <dependentAssembly name="MakingWaves.Common">
        <assemblyIdentity name="MakingWaves.Common" publicKeyToken="bbcc6a3679cba463" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.7.116.801" newVersion="1.7.116.801" />
      </dependentAssembly>
      <dependentAssembly name="MakingWaves.Common.Web">
        <assemblyIdentity name="MakingWaves.Common.Web" publicKeyToken="bbcc6a3679cba463" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.7.116.801" newVersion="1.7.116.801" />
      </dependentAssembly>
</assemblyBinding>

<pages>      
  <namespaces>        
    <add namespace="MakingWaves.Common.Web" />
    <add namespace="MakingWaves.Common" />
  </namespaces>
</pages>

<configuration>
  <makingWaves.common.web useStaticContentVersioning="false" />
  <makingWaves.common debugLogEnabled="true" />
</configuration>

Edit web.config transformation

<makingWaves.common.web useStaticContentVersioning="true" xdt:Transform="SetAttributes"/>
<makingWaves.common debugLogEnabled="false" xdt:Transform="SetAttributes"/>

If your project has no config transformation, remember to change values in configs.

Update solution structure

  • Move your styles, js etc to ~/Content i.e for styles correct path is ~/Content/Styles
  • Update all files references with
//this will return: 
//   ~/Content/Styles/Community.css (local server)
//   ~/Content/{version}/Styles/Community.css (other servers)
Assets.Styles.GetUrl("Community.css");

Edit msbuild scripts

  • remove not versioned files or folders from /Content
<RemoveDir Directories="build\Release\_PublishedWebSites\EPiServer.Templates.RelatePlus\Templates\RelatePlus\Styles" />
  • Copy files to new package
<ItemGroup>
      <_Copy Include=".\Src\ElkemIntranet.Web\Content\Styles\*.*" />
      <_CopyImages Include=".\Src\ElkemIntranet.Web\Content\Styles\**\*.*" />
</ItemGroup>
    
<Copy SourceFiles="@(_Copy)" DestinationFolder="build\Release\_PublishedWebSites\EPiServer.Templates.RelatePlus\Content\$(MaxAssemblyVersion)\Styles"/>
<Copy SourceFiles="@(_CopyImages)" DestinationFolder="build\Release\_PublishedWebSites\EPiServer.Templates.RelatePlus\Content\$(MaxAssemblyVersion)\Styles\Images"/>

Last edited Feb 17, 2014 at 7:10 AM by mjedynak, version 3

Comments

No comments yet.