<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual Studio Archives | DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/tag/visual-studio/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Thu, 03 Sep 2026 20:50:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://static.dmcinfo.com/wp-content/uploads/2025/04/site-icon-150x150.png</url>
	<title>Visual Studio Archives | DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Basic JavaScript Localization Setup Using JSON with Visual Studio Code</title>
		<link>https://static.dmcinfo.com/blog/15997/basic-javascript-localization-setup-using-json-with-visual-studio-code/</link>
		
		<dc:creator><![CDATA[Shannon Coupland]]></dc:creator>
		<pubDate>Mon, 16 Sep 2024 12:55:30 +0000</pubDate>
				<category><![CDATA[Web Application Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/15997/basic-javascript-localization-setup-using-json-with-visual-studio-code/</guid>

					<description><![CDATA[<p>Frontend localization is different than .NET backend localization in that there is not an established “correct way” to accomplish translating text in JS and related frameworks. This is a basic example using JavaScript, but more customization can be done with methods and helpers for accessing text, especially if you are using a JS framework like [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/15997/basic-javascript-localization-setup-using-json-with-visual-studio-code/">Basic JavaScript Localization Setup Using JSON with Visual Studio Code</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Frontend localization is different than .NET backend localization in that there is not an established “correct way” to accomplish translating text in JS and related frameworks. This is a basic example using JavaScript, but more customization can be done with methods and helpers for accessing text, especially if you are using a JS framework like React or Material UI.</p>



<p class="wp-block-paragraph"><strong>Prerequisites</strong></p>



<ul class="wp-block-list">
<li>Visual Studio Code installed on your machine</li>



<li>Node.js version 20.17.0 installed on your machine (other versions of Node will likely work as well)</li>



<li>General understanding of navigation in Visual Studio Code IDE</li>
</ul>



<p class="wp-block-paragraph"><strong>Steps</strong></p>



<ol class="wp-block-list">
<li>Open Visual Studio Code and create an empty folder “LocalizationExampleJS”:<br>
 <br>
 <img decoding="async" alt="Open Visual Studio Code" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Localization-JavaScript-1.png"><br>
 &nbsp;</li>



<li value="2">Add the file &ldquo;LocalizationExample.js&rdquo; at the top level of your new folder:<br />
 <br />
 <img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Localization-JavaScript-2.png"  /><br />
 &nbsp;</li>



<li value="3">Add a new subfolder &quot;Resources&quot;&nbsp;with empty files &ldquo;en-US.json&rdquo;, &ldquo;es-MX.json&rdquo;, and &ldquo;fr-FR.json&rdquo;:<br />
 <br />
 <img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Localization-JavaScript-3.png"  /><br />
 <br />
 <img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Localization-JavaScript-4.png"  /></li>



<li>Add the following code to each JSON translation file. It’s important for the text keys in all 3 files to be identical – in this case, the sample text we are using has the key “HelloWorld”.</li>
</ol>



<p class="wp-block-paragraph"><code><strong>en-US.json</strong></code></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JSON</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;code>
{
  "HelloWorld": "Hello World!"
}
es-MX.json
{
  "HelloWorld": "¡Hola Mundo!"
}
fr-FR.json
{
  "HelloWorld": "Bonjour le monde!"
}
&lt;/code></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;code&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">&quot;HelloWorld&quot;</span><span style="color: #D4D4D4">: </span><span style="color: #CE9178">&quot;Hello World!&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"><span style="color: #D4D4D4">es-MX.json</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">&quot;HelloWorld&quot;</span><span style="color: #D4D4D4">: </span><span style="color: #CE9178">&quot;¡Hola Mundo!&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"><span style="color: #D4D4D4">fr-FR.json</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">&quot;HelloWorld&quot;</span><span style="color: #D4D4D4">: </span><span style="color: #CE9178">&quot;Bonjour le monde!&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"><span style="color: #D4D4D4">&lt;/code&gt;</span></span></code></pre></div>



<ol class="wp-block-list">
<li value="5">Add the following code to &ldquo;LocalizationExample.js&rdquo;. This will enable you to supply a command line argument containing your desired locale string during testing. (Note that in an actual web frontend solution, the frontend code would need to access the current user&rsquo;s culture from the server, NOT via command line argument.)</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;code>
const args = process.argv.slice(2);
const currentCulture = args&#91;0&#93;;
console.log("Your supplied culture is: " + currentCulture);
&lt;/code></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">code</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">const args = process.argv.slice(2);</span></span>
<span class="line"><span style="color: #D4D4D4">const currentCulture = args&#91;0&#93;;</span></span>
<span class="line"><span style="color: #D4D4D4">console.log(&quot;Your supplied culture is: &quot; + currentCulture);</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">code</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<ol class="wp-block-list">
<li value="6">Below the code to extract current culture from command line arguments, add the following code to access the &ldquo;HelloWorld&rdquo; string for the supplied culture. If a culture is supplied that is not present in the application, then an error message will log accordingly, and the application will default to the &ldquo;en-US&rdquo; locale.</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;code>
var pathToJson = "./Resources/" + args&#91;0&#93; + ".json";
try {
  const jsonObj = require(pathToJson);
  console.log(jsonObj.HelloWorld);
}
catch (err) {
  console.log("Culture \"" + currentCulture + "\" does not exist in this application - using default locale en-US.")
  pathToJson = "./Resources/en-US.json";
  const jsonObj = require(pathToJson);
  console.log(jsonObj.HelloWorld);
}
&lt;/code></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">code</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">var pathToJson = &quot;./Resources/&quot; + args&#91;0&#93; + &quot;.json&quot;;</span></span>
<span class="line"><span style="color: #D4D4D4">try </span><span style="color: #569CD6">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">const</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">jsonObj</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">require</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">pathToJson</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">console</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">log</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">jsonObj</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">HelloWorld</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #569CD6">}</span></span>
<span class="line"><span style="color: #D4D4D4">catch (err) </span><span style="color: #569CD6">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">console</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">log</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Culture </span><span style="color: #D7BA7D">\&quot;</span><span style="color: #CE9178">&quot;</span><span style="color: #D4D4D4"> + </span><span style="color: #9CDCFE">currentCulture</span><span style="color: #D4D4D4"> + </span><span style="color: #CE9178">&quot;</span><span style="color: #D7BA7D">\&quot;</span><span style="color: #CE9178"> does not exist in this application - using default locale en-US.&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">pathToJson</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;./Resources/en-US.json&quot;</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">const</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">jsonObj</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">require</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">pathToJson</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">console</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">log</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">jsonObj</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">HelloWorld</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #569CD6">}</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">code</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<ol class="wp-block-list">
<li value="7">Your code is ready for testing! It should look something like this:</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;code>
const args = process.argv.slice(2);
const currentCulture = args&#91;0&#93;;
console.log("Your supplied culture is: " + currentCulture);

var pathToJson = "./Resources/" + args&#91;0&#93; + ".json";
try {
  const jsonObj = require(pathToJson);
  console.log(jsonObj.HelloWorld);
}
catch (err) {
  console.log("Culture \"" + currentCulture + "\" does not exist in this application - using default locale en-US.")
  pathToJson = "./Resources/en-US.json";
  const jsonObj = require(pathToJson);
  console.log(jsonObj.HelloWorld);
}
&lt;/code></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">code</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">const args = process.argv.slice(2);</span></span>
<span class="line"><span style="color: #D4D4D4">const currentCulture = args&#91;0&#93;;</span></span>
<span class="line"><span style="color: #D4D4D4">console.log(&quot;Your supplied culture is: &quot; + currentCulture);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">var pathToJson = &quot;./Resources/&quot; + args&#91;0&#93; + &quot;.json&quot;;</span></span>
<span class="line"><span style="color: #D4D4D4">try </span><span style="color: #569CD6">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">const</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">jsonObj</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">require</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">pathToJson</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">console</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">log</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">jsonObj</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">HelloWorld</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #569CD6">}</span></span>
<span class="line"><span style="color: #D4D4D4">catch (err) </span><span style="color: #569CD6">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">console</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">log</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Culture </span><span style="color: #D7BA7D">\&quot;</span><span style="color: #CE9178">&quot;</span><span style="color: #D4D4D4"> + </span><span style="color: #9CDCFE">currentCulture</span><span style="color: #D4D4D4"> + </span><span style="color: #CE9178">&quot;</span><span style="color: #D7BA7D">\&quot;</span><span style="color: #CE9178"> does not exist in this application - using default locale en-US.&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">pathToJson</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;./Resources/en-US.json&quot;</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">const</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">jsonObj</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">require</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">pathToJson</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">console</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">log</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">jsonObj</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">HelloWorld</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #569CD6">}</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">code</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<ol class="wp-block-list">
<li value="8">Open a terminal and test out the LocalizationExample solution using the command node <strong><code>.\LocalizationExample.js</code></strong> xx-XX, where &ldquo;xx-XX&rdquo; is a locale string representing the combination of a language and a region. Try out &ldquo;es-MX&rdquo;, &ldquo;fr-FR&rdquo;, &ldquo;en-US&rdquo;, and &ldquo;pt-BR&rdquo; (Brazilian Portuguese) as command line arguments.<br />
 <br />
 Note that the HelloWorld resource for the cultures &ldquo;en-US&rdquo;, &ldquo;es-MX&rdquo;, and &ldquo;fr-FR&rdquo; all appear translated as expected. However, the &ldquo;pt-BR&rdquo; locale yields the HelloWorld string in English, because this culture is not present in the collection of translations, and our code explicitly defaults to the &ldquo;en-US&rdquo; U.S. English locale in this case.</li>
</ol>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Localization-JavaScript-6.png" alt=""/></figure>



<h2 id="h-localization-tips-and-tricks" class="wp-block-heading"><strong>Localization Tips and Tricks</strong></h2>



<p class="wp-block-paragraph">When it comes to localization, there is a lot more to consider than simply translating text and accessing it appropriately from code. Read on to learn some tips and tricks for elevating your localization solution!</p>



<p class="wp-block-paragraph"><strong>Text Key Organization</strong></p>



<p class="wp-block-paragraph">Generally, DMC has found that it is beneficial to organize text keys into separate files based not only on language, but also based on what page of your application the text belongs on. For backend localization, this is likely best done by splitting text by controller. Here is an example of a backend localization file structure that includes two controllers, “Login.cs” and “Home.cs”, and two cultures, a default culture and “es-MX”:</p>



<ul class="wp-block-list">
<li>Resources folder
 
 
<ul class="wp-block-list" style="list-style-type:circle;">
  

<li>Login folder
  

<ul class="wp-block-list">
   

<li>Login.resx</li>


   

<li>Login.es-MX.resx</li>


  </ul>


  </li>


  

<li>Home folder
  

<ul class="wp-block-list">
   

<li>Home.resx</li>


   

<li>Home.es-MX.resx</li>


  </ul>


  </li>


 </ul>
</li>
</ul>



<p class="wp-block-paragraph">This separation organizes your translated text in a way that is easily modifiable for each individual page of your application.</p>



<p class="wp-block-paragraph">In the event that identical text appears in multiple places in your application in English, it is still beneficial to duplicate that text key/value entry across pages, rather than maintaining a single key/value item. For example, if the word “Email” exists on both the “Login” and “Home” pages in the example above, this text key/value should exist in both the “Login” resource files and “Home” resource files. This enables you to update the text in one place without modifying the same text elsewhere, if desired. Also, translations of the same English word or phrase could be different across different languages, depending on the context of how the word or phrase is used – in this case, separate text/key values are necessary for translators to appropriately translate your application text.</p>



<p class="wp-block-paragraph"><strong>Variables and Pluralization</strong></p>



<p class="wp-block-paragraph">Variables and pluralization can be quite tricky to handle in any localization solution. For a backend solution with .resx files, if you have a sentence to translate with a variable in the middle, you need to separate any given string key/value into separate parts that precede and follow the variable.</p>



<p class="wp-block-paragraph">For example, say you want to include the phrase “Hello, {name} – welcome to my site!” The following key/value structure would need to be implemented in each .resx file to handle this phrase:</p>


<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:319px;">


<p class="wp-block-paragraph"><strong>Key</strong></p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph"><strong>Value (en-US)</strong></p>



<p class="wp-block-paragraph">Hello_BeforeName</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“Hello, “</p>



<p class="wp-block-paragraph">Hello_AfterName</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“ – welcome to my site!”</p>


</td>
</tr>
</tbody>
</table>


<p class="wp-block-paragraph">&nbsp;</p>



<p class="wp-block-paragraph">Additionally, numeric variables add an extra layer of complexity to a localization solution, because pluralization must be implemented for these. The way words are pluralized can actually differ significantly across languages. For example, Slavic languages (e.g. Russian, Czech) have a different style of pluralization for 5 or more of an item than they do for zero, one, or 2-4 items. So a solution that translates to Slavic languages must implement separate logic for pluralizing 5+ items than for other items. For example, the sentence “You have {number} items in your cart!” may have a key/value structure like this in English:</p>


<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:319px;">


<p class="wp-block-paragraph"><strong>Key</strong></p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph"><strong>Value (en-US)</strong></p>



<p class="wp-block-paragraph">ItemsInCart_BeforeValue_0</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“You have “</p>



<p class="wp-block-paragraph">ItemsInCart_AfterValue_0</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“ items in your cart!”</p>



<p class="wp-block-paragraph">ItemsInCart_BeforeValue_1</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“You have “</p>



<p class="wp-block-paragraph">ItemsInCart_AfterValue_1</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“ item in your cart!”</p>



<p class="wp-block-paragraph">ItemsInCart_BeforeValue_2to4</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“You have “</p>



<p class="wp-block-paragraph">ItemsInCart_AfterValue_2to4</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“ items in your cart!”</p>



<p class="wp-block-paragraph">ItemsInCart_BeforeValue_5up</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“You have “</p>



<p class="wp-block-paragraph">ItemsInCart_AfterValue_5up</p>


</td>
<td style="width:319px;">


<p class="wp-block-paragraph">“ items in your cart!”</p>


</td>
</tr>
</tbody>
</table>


<p class="wp-block-paragraph">As you can see, this is a complex case to translate for – there are 8 total key/value pairs to accommodate just one sentence that integrates a numeric variable. To avoid the need for this, one solution is to reduce or eliminate the need for accommodating plurals – for example, you could rephrase “You have {number} items in your cart!” to instead become “Number of Items in Cart: {number}”. This would only require one key/value pair to be translated instead of eight.</p>



<p class="wp-block-paragraph"><strong>Fallback Cultures</strong></p>



<p class="wp-block-paragraph">When a user’s specific locale does not have a translation present in your application, it can be beneficial to implement fallback cultures so this user is given a more suitable approximation of their desired language. For example, say a Spanish speaker lives in Spain and therefore has their browser locale set to “es-ES”. However, your application only has resources for Mexican Spanish “es-MX”. Ideally this person in Spain would see the application in Mexican Spanish rather than the application default of English, because Mexican Spanish more closely matches their desired language than English does.</p>



<p class="wp-block-paragraph">Using .NET backend localization, fallback cultures can be implemented by simply renaming any files ending in “es-MX.resx” to instead end in “es.resx”. Per .NET’s <a href="#culture-fallback-scenarios">culture fallback scenarios</a>, upon receiving a request from the Spain Spanish user, .NET will still search for “es-ES” first. But upon not finding this specific culture, .NET will “fall back” to just the “es” portion of the locale string and will access the text as it exists in this new general Spanish file. Users using Mexican Spanish “es-MX” will see the same behavior.</p>



<p class="wp-block-paragraph"><strong>Common Pitfalls</strong></p>



<p class="wp-block-paragraph">Localization can be complicated, and there are some common pitfalls you may encounter if you are implementing your own localization solution. Here are some examples:</p>



<ul class="wp-block-list">
<li><strong>Logging / error messaging:</strong> if you are displaying raw exception messages to your users, then these are not able to be localized because they are generally hardcoded in English by the entities providing the error messages. In this case, your application should be updated to display custom error messages to your users instead of raw messages.</li>



<li><strong>Identifying EVERY source of user-facing text:</strong> There are many possible sources of text in your application that can go unnoticed, which can then become difficult to handle late in the localization process. Some examples are images, email templates, and messages from external libraries/packages/APIs. If you are doing frontend only localization, then it becomes necessary to make 100% certain that there is NO user facing text coming from the backend – if you discover late in the process that some user facing text comes from the server, then some “hacky” solutions may be necessary to preserve the frontend-only localization scheme.</li>



<li><strong>Not enforcing a single source of truth for text:</strong> If there is not a very solid system in place for establishing and updating the “source or truth” for translated text, then the localization process can quickly become messy. Things are always changing during development, and if there is not an established system to deliver text updates to translators and other stakeholders, then any one party can modify text without other stakeholders’ knowledge and introduce confusion. Enforce a single source of truth for text that all stakeholders can agree on. (Resource files are likely NOT the appropriate single source of truth, since non-developer stakeholders should also have control over text in the application.)</li>
</ul>



<div class="wp-block-group alignwide has-custom-light-blue-background-color has-background is-layout-flow wp-container-core-group-is-layout-dbd34961 wp-block-group-is-layout-flow" style="border-radius:20px;margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50);padding-right:0;padding-bottom:var(--wp--preset--spacing--50);padding-left:0">
<div class="wp-block-columns alignwide are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-43efaee5 wp-block-columns-is-layout-flex" style="padding-right:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--60)">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:85%">
<h3 class="wp-block-heading has-text-align-left" id="h-have-an-upcoming-project-dmc-can-help-you-take-the-next-step"><strong>Build Applications That Speak Your Users’ Language</strong>.</h3>



<p class="has-text-align-left wp-block-paragraph" id="h-need-help-turning-ideas-into-outcomes-automation-project-to-the-next-level-contact-us-today-to-learn-more-about-our-solutions-and-how-we-can-help-you-achieve-your-goals">Check out our <a href="https://static.dmcinfo.com/services/application-development/" data-type="page" data-id="434">Application Development</a> solutions for JavaScript localization, multilingual interfaces, and scalable translation workflows with Visual Studio Code.</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:15%">
<div class="wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-2236275c wp-block-buttons-is-layout-flex">
<div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-base-contrast-color has-text-color has-link-color wp-element-button" href="https://static.dmcinfo.com/contact/">Contact Us</a></div>
</div>
</div>
</div>
</div>
<p>The post <a href="https://static.dmcinfo.com/blog/15997/basic-javascript-localization-setup-using-json-with-visual-studio-code/">Basic JavaScript Localization Setup Using JSON with Visual Studio Code</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Remote Attach Debugger to Process in the Cloud</title>
		<link>https://static.dmcinfo.com/blog/17712/remote-attach-debugger-to-process-in-the-cloud/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Mon, 13 Mar 2023 21:37:34 +0000</pubDate>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Web Application Development]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[remote process]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/17712/remote-attach-debugger-to-process-in-the-cloud/</guid>

					<description><![CDATA[<p>This blog will show you how to remotely debug code that has been deployed to Microsoft Azure as a Function App. During one of the project stages, for various reasons, I was not able to deploy additional logging to see the parameters that were being retrieved from a database. You might think that I could&#8217;ve [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/17712/remote-attach-debugger-to-process-in-the-cloud/">Remote Attach Debugger to Process in the Cloud</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">This blog will show you how to remotely debug code that has been deployed to <a href="https://static.dmcinfo.com/services/digital-workplace-solutions/microsoft-consulting-services/microsoft-azure-cloud-solutions-and-services">Microsoft Azure</a> as a Function App.</p>

<p class="wp-block-paragraph">During one of the project stages, for various reasons, I was not able to deploy additional logging to see the parameters that were being retrieved from a database. You might think that I could&rsquo;ve simply run the code locally and seen the results there, but locally I had no access to the database due to the client&rsquo;s firewall configurations.</p>

<p class="wp-block-paragraph">The only plausible solution was to attach the debugger to the code that was running on the cloud. Seemingly, there are two main solutions in the 2022 Visual Studio, and it took me a little longer than I wish it did to connect to a remote process. To save you some time, I have summarized the&nbsp;steps I took while trying to review possible edge cases that might help you with troubleshooting.</p>

<p class="wp-block-paragraph">I put this guide together for both solution options, but I do have to warn you that&nbsp;even though the Publisher seems like a better, faster, and easier option, it did not work for my case, and I had to resort to the more manual option (which I, personally, prefer anyway).</p>

<h2 class="wp-block-heading">Both options must enable remote debugging.</h2>

<p class="wp-block-paragraph">Firstly, you will navigate to the &ldquo;General settings&rdquo; subpage of the &ldquo;Configuration&rdquo; tab of your Function App and enable remote debugging. Enabling this setting allows you to connect a remote debugger to the code running on the cloud.</p>

<p class="wp-block-paragraph" style="text-align: center;"><figure class="wp-block-image"><img decoding="async" alt="Enable remote debugging in Azure Function App configuration" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/1_remote_debugging_Azure_Function_App.png"  /></figure><em>Image 1. Enable remote debugging in Azure Function App configuration.</em></p>

<h2 class="wp-block-heading">Option 1 &ndash; &ldquo;Attach to Process&rdquo; in the Debug drop-down menu.</h2>

<p class="wp-block-paragraph">1. For option one, you will navigate to Visual Studio and select &ldquo;Attach to Process&rdquo; under the &ldquo;Debug&rdquo; option of the top bar menu panel. This item has a handy shortcut: Ctrl+Alt+P.</p>

<ul class="wp-block-list">
 <li><a href="https://learn.microsoft.com/en-us/visualstudio/debugger/attach-to-running-processes-with-the-visual-studio-debugger?view=vs-2022" target="_blank">Microsoft documentation on &ldquo;Attach to running processes with the Visual Studio debugger&rdquo;</a></li>
</ul>

<figure class="wp-block-image"><img decoding="async" alt="Select “Attach to Process” in the drop-down menu or use a Ctrl+Alt+P shortcut" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/2_Attach_to_Process.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 2. Select &ldquo;Attach to Process&rdquo; in the drop-down menu or use a Ctrl+Alt+P shortcut.</em></p>

<p class="wp-block-paragraph">2.&nbsp;You will have to provide the connection target, which you can find in the &ldquo;Overview&rdquo; of your Function App. The target is the URL to your Function Application with an appropriate Visual Studio port. Don&rsquo;t forget to omit the <em>https://</em> part of the URL.</p>

<figure class="wp-block-image"><img decoding="async" alt="Copy the target URL from the Function App Overview page." src="https://static.dmcinfo.com/wp-content/uploads/2025/05/3_copy_target_URL.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 3. Copy the target URL from the Function App Overview page.</em></p>

<p class="wp-block-paragraph">3.&nbsp;Visual Studio port is determined by its version (taken out of official <a href="https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugger-port-assignments?view=vs-2022" target="_blank">Microsoft documentation</a> as of January 2023):</p>

<p class="wp-block-paragraph" style="text-align: center;"><figure class="wp-block-image"><img decoding="async" alt="Visual Studio Version Port chart" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/4_1_Visual_Studio_Version_chart.png"  /></figure></p>

<p class="wp-block-paragraph">Note: I <strong>could not</strong> attach to a process using port <strong>4026</strong> because remote debugger ports on Microsoft Azure App Services are configurable, and they do not use the default ports associated with your version of Visual Studio. They use port <strong>4024</strong> for the remote debugger.</p>

<ul class="wp-block-list">
 <li><a href="https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugger-port-assignments?view=vs-2022" target="_blank">Microsoft documentation on &ldquo;Remote Debugger Port Assignments&rdquo;</a></li>
</ul>

<figure class="wp-block-image"><img decoding="async" alt="Use the target URL with an appropriate Visual Studio port" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/4_connection_target.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 4. Use the target URL with an appropriate Visual Studio port.</em></p>

<p class="wp-block-paragraph">4. Without clicking anything, press Enter after you are done inputting the connection target. This will prompt a window for your credentials. This part is a little misleading because, in my case, the authentication window automatically prompted me to give my laptop credentials, but those are not the ones you want to put in here. Instead,&nbsp;select the &ldquo;More choices&rdquo; option and then hit &ldquo;Use a different account.&rdquo; This will prompt for a username and a password &mdash; which you can find in Azure. Disregard the &ldquo;Domain&rdquo; part of the window as it will get populated automatically if you use the correct username.</p>

<p class="wp-block-paragraph" style="text-align: center;"><figure class="wp-block-image"><img decoding="async" alt="This is step 1 in navigating to a window where you provide credentials to connect to your application" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/5_credentiatls_to_connect_application_step_1.png"  /></figure>&nbsp; &nbsp;&nbsp;&nbsp;<figure class="wp-block-image"><img decoding="async" alt="This is step 2 in navigating to a window where you provide credentials to connect to your application" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/6_more_choices_pin.png"  /></figure>&nbsp;</p>

<p class="wp-block-paragraph" style="text-align: center;"><figure class="wp-block-image"><img decoding="async" alt="This is step 3 in navigating to a window where you provide credentials to connect to your application" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/7_username_password.png"  /></figure></p>

<p class="wp-block-paragraph" style="text-align: center;"><em>Images 5, 6, 7. (Left to right, top to bottom) These are steps 1, 2, and 3 in navigating to a window where you provide credentials to connect to your application.</em></p>

<p class="wp-block-paragraph">5. The credentials you are going to use to connect to remote processes can be found in the &ldquo;Deployment Center&rdquo; of your Function App. Navigate to the &ldquo;FTPS credentials&rdquo; subpage and copy the username and password exactly into the window that prompted you for credentials. You can also add user scope, but I did not see the necessity for it for my case.</p>

<figure class="wp-block-image"><img decoding="async" alt="Find credentials in the deployment center of your application" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/8_find_credentials.png"  /></figure>

<p class="wp-block-paragraph" align="center"><em>Image 8. Find credentials in the deployment center of your application.</em></p>

<figure class="wp-block-image"><img decoding="async" alt="Use the credentials to attach the debugger to your target" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/9_enter_credentials.png"  /></figure>

<p class="wp-block-paragraph" align="center"><em>Image 9. Use the credentials to attach the debugger to your target.</em></p>

<p class="wp-block-paragraph">6. If the connection successfully establishes, you will see various processes that you may be able to attach to. Since my application is an Azure Function App, I was only able to attach to <em>dotnet.exe &#8211; .NET Core Host</em>. I have seen online that, to attach the debugger to a Web App, you might have to use the <em>w3wp.exe &ndash; IIS Worker Process</em>.<em>&nbsp;</em></p>

<figure class="wp-block-image"><img decoding="async" alt="This is a view of processes to attach to" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/10_view_of_processes_to_attach_to.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 10. This is a view of processes to attach to.</em></p>

<p class="wp-block-paragraph">7. Once attached, you should be able to successfully set a breakpoint in your code. Since the app runs on cloud, there is a slight latency, and it might take a little longer for the code to hit the breakpoint or for you to set it &mdash; but it is almost negligible. If the breakpoint doesn&rsquo;t get set or if you encounter other issues along the way, check out <a href="https://dynamics-chronicles.com/article/how-remote-debug-azure-function" target="_blank">this blog</a> I used when&nbsp;troubleshooting.</p>

<h2 class="wp-block-heading">Option 2 &ndash; Visual Studio Publisher</h2>

<p class="wp-block-paragraph">1. If you have used the Publisher before,&nbsp;you might not even need this guide, that&rsquo;s how straightforward this method is. If not, let&rsquo;s look at how you can use the new features of Visual Studio to your advantage.<br />
Firstly, you will have to create a Publishing Profile. Right-click your function app in Visual Studio and select &ldquo;Publish&rdquo; option. This will prompt you to set up a Publishing Profile.</p>

<figure class="wp-block-image"><img decoding="async" alt="These are options for your Function App" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/11_options_of_function_app.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 11. These are options for your Function App.</em></p>

<p class="wp-block-paragraph">2. Since we are trying to attach the debugger to a Function App on Azure, we will select the Azure option.</p>

<figure class="wp-block-image"><img decoding="async" alt="These are publishing options" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/12_publishing_options.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 12. These are publishing options.</em></p>

<p class="wp-block-paragraph">3. By default, my example runs on a Windows Azure Function App, and that is the option I selected.</p>

<figure class="wp-block-image"><img decoding="async" alt="These are Azure services options" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/13_Azure_services_options.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 13. These are Azure services options.</em></p>

<p class="wp-block-paragraph">4. The next step is to select which Function App you want to connect to. I can&rsquo;t really help much here because you will need to choose which&nbsp;app, service, and resource&nbsp;you are attaching based on your environment setup.</p>

<figure class="wp-block-image"><img decoding="async" alt="Select the Azure Function App for which you are creating this Publisher" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/14_select_Azure_Function_App.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><i>Image 14. Select the Azure Function App for which you are creating this Publisher.</i></p>

<p class="wp-block-paragraph">5. You can hit &ldquo;Finish&rdquo; because the next window is optional. It asks if you want a <em>pubxml</em> or a <em>yml</em> file and, for the purpose of this guide, you should select the default <em>pubxml</em>.</p>

<figure class="wp-block-image"><img decoding="async" alt="These are Publisher format options." src="https://static.dmcinfo.com/wp-content/uploads/2025/05/15_Publisher_format_options.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 15. These are Publisher format options.</em></p>

<p class="wp-block-paragraph">6. Once you click &ldquo;Finish,&rdquo; this will automatically create the Publisher Profile for you. Successful creation will show an appropriate message.</p>

<figure class="wp-block-image"><img decoding="async" alt="This displays the successful creation of a Publisher Profile" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/16_successful_creation_Publisher_Profile.png"  /></figure>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 16. This displays the successful creation of a Publisher Profile.</em></p>

<p class="wp-block-paragraph">7. Now you should simply be able to navigate to the options of the Profile and select &ldquo;Attach Debugger.&rdquo; Make sure you publish the application in Release mode using this Publisher before attaching the debugger. This is all you need to do if you are using the Publisher. This did not work for me because the default process that the Publisher attaches to was not the Function App that I needed to debug. It was <em>w3wp.exe &ndash; IIS Worker Process</em> instead of <em>dotnet.exe &#8211; .NET Core Host</em> by default.</p>

<p class="wp-block-paragraph"><figure class="wp-block-image"><img decoding="async" alt="This is a Publisher interface to attach the debugger" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/17_Publisher_interface.png"  /></figure>&nbsp;</p>

<p class="wp-block-paragraph" style="text-align: center;"><em>Image 17. This is a Publisher interface to attach the debugger.</em></p>

<h2 class="wp-block-heading">Important troubleshooting notes:</h2>

<ol class="wp-block-list">
 <li>Your code must be up to date with the current version on the cloud. Even though I had the latest version of the code, I had to redeploy to attach the debugger. This especially applies to the Publisher Profile.</li>
 <li>When attaching to process, you might have to manually figure out where to attach. As I was debugging a .NET Azure Function Application, I had to attach to the <em>dotnet.exe</em> process, but I have seen tutorials where you had to attach to <em>w3wp.exe</em> for certain web applications.</li>
 <li>The credentials are not your laptop nor your account credentials. They are the FTPS credentials from the Deployment Center of your application.</li>
 <li>It seems that&nbsp;the Publisher option configures everything for you. The feature seems nice, but it did not work for my case. I had to specifically attach to the <em>dotnet.exe</em> process because all other processes would not load any symbols, and the Publisher had the same issue for me. It wouldn&rsquo;t load the symbols, so I could not really set any breakpoints and debug the code. I imagine that it connects to <em>w3wp.exe</em> by default as I have seen in other tutorials.</li>
 <li>Another quite crucial note is that, when you attach to process, you only attach to one process. That is, if your application is multi-threaded, then you will only attach to one thread. I learned it the hard way. Every time I attached to a process and sent a request, the breakpoint would not always get hit, and sometimes I would receive requests that I have never sent. If you do decide to proceed with this debugging technique, be prepared to rely on chance and make sure that no one else is utilizing the application because they will see some weird behavior of their processes getting stuck on your breakpoint.</li>
 <li>I have seen situations where people had to disable the &ldquo;Just My Code&rdquo; option to make this work, but I never saw the necessity in that. I have it turned off by default, but having it on should not cause any issues; however, you can try it if nothing else is working in your troubleshooting endeavors.
 <ol class="wp-block-list">
  <li><a href="https://learn.microsoft.com/en-us/visualstudio/debugger/just-my-code?view=vs-2022" target="_blank">Microsoft documentation on &ldquo;Just My Code&rdquo;</a></li>
 </ol>
 </li>
 <li>If you are using a Publisher, make sure to deploy the code under the Release mode.</li>
</ol>

<p class="wp-block-paragraph"><strong>Learn more about <a href="https://static.dmcinfo.com/services/digital-workplace-solutions/microsoft-consulting-services/microsoft-azure-cloud-solutions-and-services">DMC&rsquo;s Microsoft Azure Cloud Solutions and Services</a>&nbsp;and <a href="https://static.dmcinfo.com/contact">contact us</a> today for your next project.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/17712/remote-attach-debugger-to-process-in-the-cloud/">Remote Attach Debugger to Process in the Cloud</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
