<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><language>en</language><title>Blog posts by thomassvensen</title> <link>https://world.optimizely.com/blogs/thomassvensen/</link><description></description><ttl>60</ttl><generator>Optimizely World</generator><item> <title>Handling License.config with automated deployment</title>            <link>https://world.optimizely.com/blogs/thomassvensen/dates/2016/3/handling-license.config-with-automated-deployment</link>            <description>&lt;p&gt;I am a big fan of automated deployment tools, and our tool of choice is &lt;a href=&quot;https://octopus.com/&quot; target=&quot;_blank&quot;&gt;Octopus Deploy&lt;/a&gt;. It makes continuous deployment of new code a breeze and has lots of configuration options to support different scenarios. One challenge, though, has been handling of the License.config file in EPiServer. As you know, we want a unique developer license for each developer, and then another license when deploying to common environments such as QA and PRODUCTION.&lt;/p&gt; &lt;p&gt;Previously, we have had awkward solutions such as uploading the external license file to folder on the Octopus server itself and then having a PowerShell script to copy that file into the solution as it was deployed. This has many disadvantages, for example requiring remote access to the Octopus Server, which I do not have in my current project.&lt;/p&gt; &lt;p&gt;Consequently, we had to come up with a better solution, and after some hard thinking we now have a nice setup that others may hopefully find useful. Here are the steps we have taken:&lt;/p&gt; &lt;p&gt;1. Include License.config in your .CSPROJ file – to make sure it is included in the deployment package&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;/link/997792bf41044d49bce707dd0bf9eba0.aspx&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/a7d1cd1edad54dbbacf40caac4631853.aspx&quot; width=&quot;244&quot; height=&quot;195&quot; /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;2. Set the contents of License.config to reference an Octopus Deploy variable (that we will define later)&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;/link/cfe925aa9f0d495aa9c0c4418b17f0c6.aspx&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/3c3a3b47dbd04ed19f99e7466533cdaf.aspx&quot; width=&quot;244&quot; height=&quot;112&quot; /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;3. Check in your .CSPROJ and your License.config to your version control system (GitHub in our case)&lt;/p&gt; &lt;p&gt;4. Exclude License.config from version control – this is the Git way to do it. After this, you install your personal developer license on your machine.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;/link/87b01027a2b342d88c9a12207f2a8f0a.aspx&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/8aad8b8b519d4853ab6f2fce420d029f.aspx&quot; width=&quot;244&quot; height=&quot;63&quot; /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;5. Now, move over to Octopus Deploy and add the deployment variable #EPiServerLicense. Copy the contents of the License file provided by EPiServer into the variable value.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;/link/b9579bb38888447aae45bbd8686844fe.aspx&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/f54029a8d16b4333b384c4a48ab1e355.aspx&quot; width=&quot;244&quot; height=&quot;24&quot; /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;NOTE! &lt;/strong&gt;If you have non-ASCII letters in your license file, you will need to including …&lt;font face=&quot;Courier New&quot;&gt;encoding=”iso-8859-1&lt;/font&gt;”… in the XML header, as you can see we have done in the screenshot!&lt;/p&gt;    &lt;p&gt;6. Finally, in the “Deploy packages” process stage in Octopus Deploy, you activate the feature “Substitue variables in files” and enter “License.config” in the text box.&lt;/p&gt; &lt;p&gt;7. You are now ready to deploy. After deployment is done, you can verify that the variable substition worked by checking the Octopus log.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;/link/38ace0300b6542c89aea266666d081cc.aspx&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/a8897a69ef5f47d292c7728d0d5c2cc1.aspx&quot; width=&quot;244&quot; height=&quot;54&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description>            <guid>https://world.optimizely.com/blogs/thomassvensen/dates/2016/3/handling-license.config-with-automated-deployment</guid>            <pubDate>Tue, 29 Mar 2016 11:12:55 GMT</pubDate>           <category>Blog post</category></item></channel>
</rss>