<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Harry Balls</title>
    <description>The latest articles on DEV Community by Harry Balls (@elleattwell).</description>
    <link>https://dev.to/elleattwell</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F217108%2Fc0375426-477f-4a23-a167-410fe54f8ed2.jpg</url>
      <title>DEV Community: Harry Balls</title>
      <link>https://dev.to/elleattwell</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/elleattwell"/>
    <language>en</language>
    <item>
      <title>Google tries to translate "Lorem ipsum"</title>
      <dc:creator>Harry Balls</dc:creator>
      <pubDate>Fri, 11 Sep 2020 12:23:49 +0000</pubDate>
      <link>https://dev.to/elleattwell/google-tries-to-translate-lorem-ipsum-b89</link>
      <guid>https://dev.to/elleattwell/google-tries-to-translate-lorem-ipsum-b89</guid>
      <description>&lt;p&gt;As we all know &lt;em&gt;Lorem ipsum&lt;/em&gt; is a placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.&lt;/p&gt;

&lt;h1&gt;
  
  
  Original
&lt;/h1&gt;

&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;

&lt;h1&gt;
  
  
  From Google Translate
&lt;/h1&gt;

&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed tempor and vitality, so that the labor and sorrow, some important things to do eiusmod. Over the years all will I come, so that stimulus efforts if the school district who has nostrud oefening aliquip out of her the advantage of the recipe. Want to be a pain in the cupidatat oute cillum Duis et dolore magna criticized in the run produces no resultant pleasure. Excepteur cupidatat blacks are not excepteur, is soothing to the soul, that is, they deserted the general duties of those who are to blame for your troubles.&lt;/p&gt;

&lt;p&gt;I was bored.&lt;br&gt;
:)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DevOps, Release Pipeline, Console App, Replace Endpoints</title>
      <dc:creator>Harry Balls</dc:creator>
      <pubDate>Thu, 26 Sep 2019 12:23:50 +0000</pubDate>
      <link>https://dev.to/elleattwell/devops-release-pipeline-console-app-replace-endpoints-359o</link>
      <guid>https://dev.to/elleattwell/devops-release-pipeline-console-app-replace-endpoints-359o</guid>
      <description>&lt;p&gt;So recently, I had to work on a project that required me to create pipelines (build, release) on Azure DevOps.&lt;/p&gt;

&lt;p&gt;I had a simple console application which called two WCF services to authenticate for security, retrieve (i.e. database) and then give me a list of users I needed to send out SMS's to.&lt;/p&gt;

&lt;p&gt;I then created my build, here’s how it looks. The build executes in sequence, from top to bottom.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fSRKpAQN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/99rqk3koedfpsw1cjpoc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fSRKpAQN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/99rqk3koedfpsw1cjpoc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I then created my release pipeline, here’s how it looks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uKFVT19k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2e5a7nfdibwd5d7fupvy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uKFVT19k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2e5a7nfdibwd5d7fupvy.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;File Transform task basically points to the file path to the package or folder which points to the bin/Release folder and the target files that need to be transformed to XML, in this case there’s two (i.e. dll.config and exe.config)&lt;/p&gt;

&lt;p&gt;Copy Files to task specifies the source folder to copy from after the file transform, and then specifies the target folder to copy to.&lt;/p&gt;

&lt;p&gt;The last task is a PowerShell Script to run the console app project named Replace App Config Endpoints, which will then replace all the endpoint addresses.&lt;/p&gt;

&lt;p&gt;I’ve done a build and a release for a normal website before and all I had to do was to create a SetParameters.xml file and define all the tokens/variables I needed to be replaced.&lt;/p&gt;

&lt;p&gt;So here’s the problem I faced, I couldn’t find anything online to do this for me and the SetParameters.xml replaced app settings and connection strings, I’m sure there is but my Googling skills failed me that time.&lt;/p&gt;

&lt;p&gt;PROBLEM: I needed to replace the WCF endpoint addresses for the specific environments (i.e. QA, Production) variable values.&lt;/p&gt;

&lt;p&gt;SOLUTION: I created a console application to do this for me which will be run by the PowerShell Script.&lt;/p&gt;

&lt;p&gt;Please note, Environment.GetEnvironmentVariable() will retrieve the value of an environment variable from the current process. We can specify different values based on whether the Environment is QA or Production.&lt;/p&gt;

&lt;p&gt;Here’s how it looks&lt;/p&gt;

&lt;p&gt;args expects the full path(s) to the config we need to replace the service endpoint addresses for e.g. "C:\Users\Projects\projectname1\bin\Debug\projectname1.exe.config" &lt;br&gt;
"C:\Users\Projects\projectname2\bin\Debug\projectname2.exe.config"  &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    static void Main(string[] args)
    {
        try
        {
            foreach (var appConfigFilePath in args)
            {
                var doc = new XmlDocument();
                doc.Load(appConfigFilePath);
                XmlNodeList endpoints = doc.GetElementsByTagName("endpoint");

                foreach (XmlNode item in endpoints)
                {
                    doc.GetElementsByTagName("endpoint").Cast&amp;lt;XmlNode&amp;gt;()
                        .FirstOrDefault(n =&amp;gt; n.Attributes["name"].Value == item.Attributes["name"].Value).Attributes["address"].Value = Environment.GetEnvironmentVariable(item.Attributes["name"].Value);
                }

                doc.Save(appConfigFilePath);
            }
        }
        catch (Exception)
        {
            // catch exception and log error
        }
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If anyone has a different approach or can extend this please feel free to point me in the right direction.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>csharp</category>
      <category>dotnet</category>
    </item>
  </channel>
</rss>
