EPiServer och Configuration Management
EPiServer och Configuration Management Configuration Management in general Tools we use SCM – Structure of folder and project Web.config Tips about Project Files and Assembly references 2
CM Tools used at INEXOR Team Foundation Server MSBuild Community Tasks Scrum for Team System TFS Build for Continuous Integration EPiServer Scrum Dashboard 3
Struktur 4
Structure Single Solution Partitioned Solution 5
Structure - Common Code Shared with branching Control of update Maintain inside project and Merge Up changes Cloaking 6
Visual Studio adds <assemblies> to web.config <compilation defaultLanguage="c#" debug="true"> <assemblies> <add assembly="EPiServer, Version=5.1.422.122, Culture=neutral, PublicKeyToken=8FE83DEA738B45B7"/> [ . . . ] </assemblies> </compilation> Tip: Remove the whole <assemblies> -tag or at least all EPiServer references. 7
Visual Studio adds <%@ Register %> to markup Tip: Always delete "<% @ Register TagPrefix ="EPiServer" … %>" from you markup. Tip: Consider adding you own controls to the <pages><controls> -tag in your web.config instead of adding a <%@ Register %> -tag on every page. Tip: Remove the version number and public key from the assembly attribute. 8
Use <bindingRedirect> in your web.config Uppdateras automatisk av EPiServer Installer/Deployment Center Tip : Missa inte xmlns attributet! <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/> </dependentAssembly> </assemblyBinding> 9
Fix your references by editing your csproj-file Tip : Create a shared Library-folder and store a checked in copy of all references assemblies. Tip : Edit your csproj-file as text and make sure it only refers assemblies in your Library-folder. You only need to keep only the assembly name. <Reference Include="StarSuite.Core"> <HintPath>..\Library\StarSuite.Core.dll</HintPath> </Reference> Tip : Use project references and do not include DLL’s from bin folder. 10
Do not check-in bin folder Tip: Copy Solution Library folder to OutDir on Build <Target Name="BeforeBuild"> <ItemGroup> <LibraryItemsToCopy Include="..\Library\**\*.*" /> </ItemGroup> <Copy SourceFiles="@(LibraryItemsToCopy )“ DestinationFiles="@(LibraryItemsToCopy- >'$(OutDir)%(RecursiveDir )%(Filename)%(Extension)')“ SkipUnchangedFiles ="True“ OverwriteReadOnlyFiles="True" /> </Target> 11
Demo *.Web.csproj TfsBuild.proj 12
Web.config Komplex - Bör versionshanteras och kompileras! Vi använder MSBuild Community Tools XmlMassUpdate 13
Exampel 1/4 <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="ItemsPerPage" value="10" /> <add key="EnableCaching" value="true" /> <add key="DefaultServer" value="TIGRIS" /> </appSettings> <system.web> <compilation defaultLanguage="c#" debug="true" /> <customErrors mode="Off" /> <trace enabled="true" requestLimit="10" pageOutput="true" /> <globalization requestEncoding="utf-8" responseEncoding="utf-8" /> </system.web> </configuration> 14
Example 2/4 • MSBuild Task in your project-file: <XmlMassUpdate ContentFile="web.config" SubstitutionsFile="changes.xml" ContentRoot="/configuration/system.web" SubstitutionsRoot="/system.web" /> • Change.xml <system.web> <compilation debug="false" /> <customErrors mode="RemoteOnly" defaultRedirect="Error.htm"> <error statusCode="401" redirect="AccessDenied.aspx" /> </customErrors> <trace enabled="false" /> </system.web> 15
Example 3/4 MSBuild Task in your Project-file: <XmlMassUpdate ContentFile="web.config" SubstitutionsFile="changes.xml" MergedFile="web.config.keyed.xml" /> Web.config.keyed.xml <configuration xmlns:xmu="urn:msbuildcommunitytasks-xmlmassupdate"> <appSettings> <add xmu:key="key" key="EnableCaching" value="false" /> <add xmu:key="key" key="DefaultSort" value="LastName" /> <add xmu:key="key" key="ItemsPerPage" xmu:action="remove" /> <trace xmu:action="remove" /> </appSettings> </configuration> 16
Example 4/4 <XmlMassUpdate ContentFile="web.config" ContentRoot="/configuration" SubstitutionsRoot="/configuration/substitutions/$(TargetEnvironment)" /> <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation defaultLanguage="c#" debug="true" /> <customErrors mode="Off" /> <trace enabled="true" requestLimit="10" pageOutput="true" /> <globalization requestEncoding="utf-8" responseEncoding="utf-8" /> </system.web> <substitutions> <test> <system.web> <compilation debug="false" /> <trace enabled="true" /> </system.web> </test> <prod> <system.web> <compilation debug="false" /> <trace enabled="false" /> </system.web> </prod> </substitutions> </configuration> 17
Frågor & Svar 18
Nu blir det REKLAM… INEXOR AB säljer konsulttjänster och utbildning. Till exempel … Halvdags workshop inför EPiServer certifiering Configuration Management Workshop Kodgranskning Felsökning och problemlösning på plats 19
Referenser patterns & practices: Team Development with VS TFS http://www.codeplex.com/TFSGuide Scrum for Team System http://scrumforteamsystem.com EPiServer Scrum Dashboard http://www.codeplex.com/scrumdashboard 20
Recommend
More recommend