-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeed.xml
839 lines (561 loc) · 73.9 KB
/
feed.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.2.2">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" hreflang="en" /><updated>2023-12-14T17:56:41-08:00</updated><id>/feed.xml</id><title type="html">Primo Software</title><subtitle>&copy; Primo Software</subtitle><author><name>Primo Software</name></author><entry><title type="html">Getting Started with .NET and Visual Studio Code on Windows</title><link href="/getting-started-net-visual-studio-code-windows/" rel="alternate" type="text/html" title="Getting Started with .NET and Visual Studio Code on Windows" /><published>2023-11-24T00:00:00-08:00</published><updated>2023-11-24T00:00:00-08:00</updated><id>/getting-started-net-visual-studio-code-windows</id><content type="html" xml:base="/getting-started-net-visual-studio-code-windows/"><![CDATA[<p>Before going through these steps make sure you have done <a href="/setup-net-development-environment-windows">Setup .NET development environment on Windows</a></p>
<h2 id="visual-studio-code">Visual Studio Code</h2>
<p>Download and install from <a href="https://code.visualstudio.com/download">Visual Studio Code</a> site.</p>
<p>Open Visual Studio Code and press <code class="language-plaintext highlighter-rouge">Ctrl + Shift + P</code>. Select <code class="language-plaintext highlighter-rouge">Shell Command: Install 'code' command in PATH</code>.</p>
<p>Close Visual Studio Code.</p>
<h2 id="project-directory">Project Directory</h2>
<p>Create a directory called <code class="language-plaintext highlighter-rouge">simple</code> in <code class="language-plaintext highlighter-rouge">~/net/simple</code></p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mkdir</span><span class="w"> </span><span class="nx">~/net/simple</span><span class="w">
</span></code></pre></div></div>
<h2 id="net-project-files">.NET Project Files</h2>
<p>Create the project files:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">cd</span><span class="w"> </span><span class="nx">~/net/simple</span><span class="w">
</span><span class="c"># Switch to use .NET SDK 6.0, 7.0 or 8.0. We do 8.0 here but give the commands for other versions </span><span class="w">
</span><span class="c"># dotnet new globaljson --sdk-version 6.0.417 --roll-forward latestPatch</span><span class="w">
</span><span class="c"># dotnet new globaljson --sdk-version 7.0.404 --roll-forward latestPatch</span><span class="w">
</span><span class="n">dotnet</span><span class="w"> </span><span class="nx">new</span><span class="w"> </span><span class="nx">globaljson</span><span class="w"> </span><span class="nt">--sdk-version</span><span class="w"> </span><span class="nx">8.0.100</span><span class="w"> </span><span class="nt">--roll-forward</span><span class="w"> </span><span class="nx">latestPatch</span><span class="w">
</span><span class="c"># create new console application and project</span><span class="w">
</span><span class="n">dotnet</span><span class="w"> </span><span class="nx">new</span><span class="w"> </span><span class="nx">console</span><span class="w"> </span><span class="nt">--framework</span><span class="w"> </span><span class="nx">net6.0</span><span class="w">
</span><span class="c"># create new solution and add the project to it</span><span class="w">
</span><span class="n">dotnet</span><span class="w"> </span><span class="nx">new</span><span class="w"> </span><span class="nx">sln</span><span class="w">
</span><span class="n">dotnet</span><span class="w"> </span><span class="nx">sln</span><span class="w"> </span><span class="nx">add</span><span class="w"> </span><span class="nx">simple.csproj</span><span class="w">
</span><span class="c"># add .gitignore</span><span class="w">
</span><span class="n">dotnet</span><span class="w"> </span><span class="nx">new</span><span class="w"> </span><span class="nx">gitignore</span><span class="w">
</span></code></pre></div></div>
<p>Open the directory in Visual Studio Code:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">cd</span><span class="w"> </span><span class="nx">~/net/simple</span><span class="w">
</span><span class="n">code</span><span class="w"> </span><span class="o">.</span><span class="w">
</span></code></pre></div></div>
<p>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit">C# Dev Kit extension</a> for Visual Studio Code.</p>
<h2 id="automate-the-build">Automate the build</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodetasksjson"><code class="language-plaintext highlighter-rouge">.vscode/tasks.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2.0.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tasks"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet"</span><span class="p">,</span><span class="w">
</span><span class="nl">"task"</span><span class="p">:</span><span class="w"> </span><span class="s2">"build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"group"</span><span class="p">:</span><span class="w"> </span><span class="s2">"build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"problemMatcher"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
</span><span class="nl">"label"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet: build"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>Test the build by pressing <code class="language-plaintext highlighter-rouge">Ctrl + Shift + B</code>. Visual Studio Code should execute the <code class="language-plaintext highlighter-rouge">build.sh</code> script automatically.</p>
<h2 id="setup-debugging">Setup Debugging</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodelaunchjson"><code class="language-plaintext highlighter-rouge">.vscode/launch.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.2.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"configurations"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">".NET Core Launch (console)"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"coreclr"</span><span class="p">,</span><span class="w">
</span><span class="nl">"request"</span><span class="p">:</span><span class="w"> </span><span class="s2">"launch"</span><span class="p">,</span><span class="w">
</span><span class="nl">"preLaunchTask"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet: build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"program"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}/bin/Debug/net6.0/simple.dll"</span><span class="p">,</span><span class="w">
</span><span class="nl">"args"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
</span><span class="nl">"cwd"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"console"</span><span class="p">:</span><span class="w"> </span><span class="s2">"internalConsole"</span><span class="p">,</span><span class="w">
</span><span class="nl">"stopAtEntry"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<h2 id="test-the-debugging">Test the debugging</h2>
<p>Set a breakpoint at the <code class="language-plaintext highlighter-rouge">Console.WriteLine("Hello, World!");</code> line in <code class="language-plaintext highlighter-rouge">Programs.cs</code>:</p>
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// See https://aka.ms/new-console-template for more information</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">"Hello, World!"</span><span class="p">);</span>
</code></pre></div></div>
<p>Press <code class="language-plaintext highlighter-rouge">F5</code> to launch the debugger. It should stop at the breakpoint.</p>]]></content><author><name>Primo Software</name></author><category term="csharp" /><category term="vscode" /><category term="dotnet" /><category term="windows" /><summary type="html"><![CDATA[Before going through these steps make sure you have done Setup .NET development environment on Windows Visual Studio Code Download and install from Visual Studio Code site. Open Visual Studio Code and press Ctrl + Shift + P. Select Shell Command: Install 'code' command in PATH. Close Visual Studio Code.]]></summary></entry><entry><title type="html">Setup .NET development environment on Windows</title><link href="/setup-net-development-environment-windows/" rel="alternate" type="text/html" title="Setup .NET development environment on Windows" /><published>2023-11-23T00:00:00-08:00</published><updated>2023-11-23T00:00:00-08:00</updated><id>/setup-net-development-environment-windows</id><content type="html" xml:base="/setup-net-development-environment-windows/"><![CDATA[<h1 id="setup-for-windows">Setup for Windows</h1>
<blockquote>
<p>Scripts are PowerShell.</p>
</blockquote>
<p>Download the <code class="language-plaintext highlighter-rouge">dotnet-install.ps1</code> script</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Invoke-WebRequest</span><span class="w"> </span><span class="s1">'https://dot.net/v1/dotnet-install.ps1'</span><span class="w"> </span><span class="nt">-OutFile</span><span class="w"> </span><span class="s1">'dotnet-install.ps1'</span><span class="p">;</span><span class="w">
</span></code></pre></div></div>
<h2 id="net-runtime">.NET Runtime</h2>
<h3 id="net-runtime-60-lts">.NET Runtime 6.0 (LTS)</h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">.</span><span class="n">/dotnet-install.ps1</span><span class="w"> </span><span class="nt">-InstallDir</span><span class="w"> </span><span class="s1">'~/.dotnet'</span><span class="w"> </span><span class="nt">-Channel</span><span class="w"> </span><span class="nx">6.0</span><span class="w"> </span><span class="nt">-Runtime</span><span class="w"> </span><span class="nx">dotnet</span><span class="w"> </span><span class="nt">-Version</span><span class="w"> </span><span class="nx">latest</span><span class="w">
</span></code></pre></div></div>
<p>or download and install from <a href="https://dotnet.microsoft.com/en-us/download/dotnet/6.0">Microsoft</a></p>
<h3 id="net-runtime-70">.NET Runtime 7.0</h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">.</span><span class="n">/dotnet-install.ps1</span><span class="w"> </span><span class="nt">-InstallDir</span><span class="w"> </span><span class="s1">'~/.dotnet'</span><span class="w"> </span><span class="nt">-Channel</span><span class="w"> </span><span class="nx">7.0</span><span class="w"> </span><span class="nt">-Runtime</span><span class="w"> </span><span class="nx">dotnet</span><span class="w"> </span><span class="nt">-Version</span><span class="w"> </span><span class="nx">latest</span><span class="w">
</span></code></pre></div></div>
<p>or download and install from <a href="https://dotnet.microsoft.com/en-us/download/dotnet/7.0">Microsoft</a></p>
<h3 id="net-runtime-80-lts">.NET Runtime 8.0 (LTS)</h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">.</span><span class="n">/dotnet-install.ps1</span><span class="w"> </span><span class="nt">-InstallDir</span><span class="w"> </span><span class="s1">'~/.dotnet'</span><span class="w"> </span><span class="nt">-Channel</span><span class="w"> </span><span class="nx">8.0</span><span class="w"> </span><span class="nt">-Runtime</span><span class="w"> </span><span class="nx">dotnet</span><span class="w"> </span><span class="nt">-Version</span><span class="w"> </span><span class="nx">latest</span><span class="w">
</span></code></pre></div></div>
<p>or download and install from <a href="https://dotnet.microsoft.com/en-us/download/dotnet/8.0">Microsoft</a></p>
<h2 id="net-sdk">.NET SDK</h2>
<h3 id="net-48">.NET 4.8</h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mkdir</span><span class="w"> </span><span class="nx">~/Downloads</span><span class="w">
</span><span class="n">cd</span><span class="w"> </span><span class="nx">~/Downloads</span><span class="w">
</span><span class="n">Start-BitsTransfer</span><span class="w"> </span><span class="se">`
</span><span class="w"> </span><span class="nt">-Source</span><span class="w"> </span><span class="s1">'https://go.microsoft.com/fwlink/?linkid=2088517'</span><span class="w"> </span><span class="se">`
</span><span class="w"> </span><span class="nt">-Destination</span><span class="w"> </span><span class="s2">".\ndp48-devpack-enu.exe"</span><span class="w">
</span><span class="o">&</span><span class="w"> </span><span class="o">.</span><span class="n">/ndp48-devpack-enu.exe</span><span class="w"> </span><span class="nx">/q</span><span class="w"> </span><span class="nx">/norestart</span><span class="w"> </span><span class="nx">/log</span><span class="w"> </span><span class="nx">ndp48-devpack-enu.log</span><span class="w">
</span><span class="c"># For non-silent install</span><span class="w">
</span><span class="c"># & ./ndp48-devpack-enu.exe </span><span class="w">
</span></code></pre></div></div>
<h3 id="net-60">.NET 6.0</h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">.</span><span class="n">/dotnet-install.ps1</span><span class="w"> </span><span class="nt">-InstallDir</span><span class="w"> </span><span class="s1">'~/.dotnet'</span><span class="w"> </span><span class="nt">-Channel</span><span class="w"> </span><span class="nx">6.0</span><span class="w">
</span></code></pre></div></div>
<h3 id="net-70">.NET 7.0</h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">.</span><span class="n">/dotnet-install.ps1</span><span class="w"> </span><span class="nt">-InstallDir</span><span class="w"> </span><span class="s1">'~/.dotnet'</span><span class="w"> </span><span class="nt">-Channel</span><span class="w"> </span><span class="nx">7.0</span><span class="w">
</span></code></pre></div></div>
<h3 id="net-80">.NET 8.0</h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">.</span><span class="n">/dotnet-install.ps1</span><span class="w"> </span><span class="nt">-InstallDir</span><span class="w"> </span><span class="s1">'~/.dotnet'</span><span class="w"> </span><span class="nt">-Channel</span><span class="w"> </span><span class="nx">8.0</span><span class="w">
</span></code></pre></div></div>
<h2 id="test">Test</h2>
<p>Test that you can run the <code class="language-plaintext highlighter-rouge">dotnet</code> CLI (command line interface)</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">dotnet</span><span class="w"> </span><span class="nt">--version</span><span class="w">
</span><span class="n">dotnet</span><span class="w"> </span><span class="nx">new</span><span class="w"> </span><span class="nx">console</span><span class="w"> </span><span class="nt">--help</span><span class="w">
</span></code></pre></div></div>]]></content><author><name>Primo Software</name></author><category term="csharp" /><category term="dotnet" /><category term="windows" /><summary type="html"><![CDATA[Setup for Windows Scripts are PowerShell. Download the dotnet-install.ps1 script Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1';]]></summary></entry><entry><title type="html">Getting Started with C++ and Visual Studio Code on Windows</title><link href="/getting-started-cpp-visual-studio-code-windows/" rel="alternate" type="text/html" title="Getting Started with C++ and Visual Studio Code on Windows" /><published>2023-11-22T00:00:00-08:00</published><updated>2023-11-22T00:00:00-08:00</updated><id>/getting-started-cpp-visual-studio-code-windows</id><content type="html" xml:base="/getting-started-cpp-visual-studio-code-windows/"><![CDATA[<p>Before going through these steps make sure you have done <a href="/setup-cpp-development-environment-windows">Setup C++ development environment on Windows</a></p>
<h2 id="visual-studio-code">Visual Studio Code</h2>
<p>Download and install from <a href="https://code.visualstudio.com/download">Visual Studio Code</a> site.</p>
<p>Open Visual Studio Code and press <code class="language-plaintext highlighter-rouge">Cmd + Shift + P</code>. Select <code class="language-plaintext highlighter-rouge">Shell Command: Install 'code' command in PATH</code>.</p>
<h2 id="c-project">C++ Project</h2>
<p>Create a directory called simple in <code class="language-plaintext highlighter-rouge">~/cpp/simple</code></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> ~/cpp/simple
</code></pre></div></div>
<p>Add a configuration script <code class="language-plaintext highlighter-rouge">configure.ps1</code>:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$temp_file</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">IO.Path</span><span class="p">]::</span><span class="n">GetTempFileName</span><span class="p">()</span><span class="w">
</span><span class="c"># find where Visual Studio 2022 is installed</span><span class="w">
</span><span class="nv">$vs_install_dir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="err">$</span><span class="p">(</span><span class="n">Get-VSSetupInstance</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Select-VSSetupInstance</span><span class="w"> </span><span class="nt">-Version</span><span class="w"> </span><span class="s1">'[17.0,18.0]'</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Select-Object</span><span class="w"> </span><span class="nt">-ExpandProperty</span><span class="w"> </span><span class="nx">InstallationPath</span><span class="p">)</span><span class="w">
</span><span class="nv">$vs_common_tools</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"</span><span class="nv">${vs_install_dir}</span><span class="s2">/Common7/Tools/"</span><span class="w">
</span><span class="c"># run `VsDevCmd.bat -arch=amd64 -host_arch=amd64` and save environment to $temp_file</span><span class="w">
</span><span class="n">cmd</span><span class="w"> </span><span class="nx">/c</span><span class="w"> </span><span class="s2">" </span><span class="se">`"</span><span class="nv">$vs_common_tools</span><span class="s2">/VsDevCmd.bat</span><span class="se">`"</span><span class="s2"> -arch=amd64 -host_arch=amd64 && set > </span><span class="se">`"</span><span class="nv">$temp_file</span><span class="se">`"</span><span class="s2">"</span><span class="w">
</span><span class="c"># copy the environment variables into PowerShell</span><span class="w">
</span><span class="n">Get-Content</span><span class="w"> </span><span class="nv">$temp_file</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Foreach-Object</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="kr">if</span><span class="p">(</span><span class="bp">$_</span><span class="w"> </span><span class="o">-match</span><span class="w"> </span><span class="s2">"^(.*?)=(.*)$"</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="n">Set-Content</span><span class="w"> </span><span class="s2">"env:\</span><span class="si">$(</span><span class="nv">$matches</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">)</span><span class="s2">"</span><span class="w"> </span><span class="nv">$matches</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="n">Remove-Item</span><span class="w"> </span><span class="nv">$temp_file</span><span class="w">
</span></code></pre></div></div>
<p>Open the directory in Visual Studio Code. It is important to source the <code class="language-plaintext highlighter-rouge">configure.ps1</code> script before running <code class="language-plaintext highlighter-rouge">code .</code> in order to setup the correct C++ environment:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">cd</span><span class="w"> </span><span class="nx">~/cpp/simple</span><span class="w">
</span><span class="o">.</span><span class="w"> </span><span class="o">.</span><span class="n">\configure.ps1</span><span class="w">
</span><span class="n">code</span><span class="w"> </span><span class="o">.</span><span class="w">
</span></code></pre></div></div>
<p>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack">C/C++ Extension Pack</a>.</p>
<h2 id="project-files">Project Files</h2>
<p>Add the following files:</p>
<h3 id="srcmaincpp"><code class="language-plaintext highlighter-rouge">src/main.cpp</code></h3>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include</span> <span class="cpf"><iostream></span><span class="cp">
</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
<span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o"><<</span> <span class="s">"Hello CMake!</span><span class="se">\n</span><span class="s">"</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div></div>
<h3 id="cmakeliststxt"><code class="language-plaintext highlighter-rouge">CMakeLists.txt</code></h3>
<div class="language-cmake highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cmake_minimum_required</span><span class="p">(</span>VERSION 3.20<span class="p">)</span>
<span class="nb">project</span><span class="p">(</span>simple<span class="p">)</span>
<span class="nb">add_executable</span><span class="p">(</span>simple src/main.cpp<span class="p">)</span>
</code></pre></div></div>
<h3 id="buildps1"><code class="language-plaintext highlighter-rouge">build.ps1</code></h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">New-Item</span><span class="w"> </span><span class="nt">-Force</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="o">.</span><span class="nx">/build/debug</span><span class="w"> </span><span class="nt">-ItemType</span><span class="w"> </span><span class="nx">Directory</span><span class="w">
</span><span class="n">Push-Location</span><span class="w"> </span><span class="o">.</span><span class="nx">/build/debug</span><span class="w">
</span><span class="n">cmake</span><span class="w"> </span><span class="nt">-G</span><span class="w"> </span><span class="s1">'Ninja'</span><span class="w"> </span><span class="nt">-DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">debug</span><span class="w"> </span><span class="o">..</span><span class="nx">/..</span><span class="w">
</span><span class="n">ninja</span><span class="w">
</span><span class="nx">Pop-Location</span><span class="w">
</span></code></pre></div></div>
<h3 id="gitignore"><code class="language-plaintext highlighter-rouge">.gitignore</code></h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>build/
</code></pre></div></div>
<h2 id="test-the-build">Test the build</h2>
<p>Open Terminal in Visual Studio Code and test the build from command line:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./build.ps1
</code></pre></div></div>
<h2 id="automate-the-build">Automate the build</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodetasksjson"><code class="language-plaintext highlighter-rouge">.vscode/tasks.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2.0.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tasks"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"label"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"shell"</span><span class="p">,</span><span class="w">
</span><span class="nl">"windows"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"command"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}/build.ps1"</span><span class="p">,</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"group"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"kind"</span><span class="p">:</span><span class="w"> </span><span class="s2">"build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"isDefault"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>Test the build by pressing <code class="language-plaintext highlighter-rouge">Ctrl + Shift + B</code>. Visual Studio Code should execute the <code class="language-plaintext highlighter-rouge">build.ps1</code> script automatically.</p>
<h2 id="setup-debugging">Setup Debugging</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodelaunchjson"><code class="language-plaintext highlighter-rouge">.vscode/launch.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.2.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"configurations"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Debug (cppvsdbg)"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"cppdbg"</span><span class="p">,</span><span class="w">
</span><span class="nl">"request"</span><span class="p">:</span><span class="w"> </span><span class="s2">"launch"</span><span class="p">,</span><span class="w">
</span><span class="nl">"cwd"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"windows"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"cppvsdbg"</span><span class="p">,</span><span class="w">
</span><span class="nl">"program"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}/build/debug/simple.exe"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"preLaunchTask"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Build"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<h2 id="test-the-debugging">Test the debugging</h2>
<p>Set a breakpoint on the first line of <code class="language-plaintext highlighter-rouge">int main()</code> inside <code class="language-plaintext highlighter-rouge">src/main.cpp</code>. Press <code class="language-plaintext highlighter-rouge">F5</code> to launch the debugger. It should stop at the breakpoint.</p>]]></content><author><name>Primo Software</name></author><category term="vscode" /><category term="cpp" /><category term="windows" /><summary type="html"><![CDATA[Before going through these steps make sure you have done Setup C++ development environment on Windows Visual Studio Code Download and install from Visual Studio Code site. Open Visual Studio Code and press Cmd + Shift + P. Select Shell Command: Install 'code' command in PATH.]]></summary></entry><entry><title type="html">Setup C++ development environment on Windows</title><link href="/setup-cpp-development-environment-windows/" rel="alternate" type="text/html" title="Setup C++ development environment on Windows" /><published>2023-11-21T00:00:00-08:00</published><updated>2023-11-21T00:00:00-08:00</updated><id>/setup-cpp-development-environment-windows</id><content type="html" xml:base="/setup-cpp-development-environment-windows/"><![CDATA[<p>These steps were tested on Windows 11, 23H2. Scripts are <code class="language-plaintext highlighter-rouge">PowerShell</code>.</p>
<h2 id="visual-studio-2022">Visual Studio 2022</h2>
<p>This is needed for the C++ compiler. Install <a href="https://visualstudio.microsoft.com/vs/older-downloads/">Visual Studio 2022 Community Edition</a>.</p>
<p>During installation select C++ desktop development and latest Windows 10 and Windows 11 SDKs.</p>
<p>After installation open Visual Studio and check for updates. Install the latest 2022 version that is available.</p>
<h2 id="cmake">CMake</h2>
<p>Install via Windows Package Manager:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">winget</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">kitware.cmake</span><span class="w">
</span></code></pre></div></div>
<h2 id="ninja">ninja</h2>
<p>Install via Windows Package Manager:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">winget</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">Ninja-build.Ninja</span><span class="w">
</span></code></pre></div></div>
<h2 id="powershell-configuration">PowerShell Configuration</h2>
<p>This will allow you to execute PowerShell scripts locally on your machine. In PowerShell as Administrator:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Set-ExecutionPolicy</span><span class="w"> </span><span class="nt">-ExecutionPolicy</span><span class="w"> </span><span class="nx">RemoteSigned</span><span class="w"> </span><span class="nt">-Scope</span><span class="w"> </span><span class="nx">LocalMachine</span><span class="w">
</span></code></pre></div></div>
<h3 id="environment">Environment</h3>
<p>Update <code class="language-plaintext highlighter-rouge">$env:PSModulePath</code> so that you can use PowerShell modules. In PowerShell as Administrator:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="n">Environment</span><span class="p">]::</span><span class="n">SetEnvironmentVariable</span><span class="p">(</span><span class="s2">"PSModulePath"</span><span class="p">,</span><span class="w"> </span><span class="s2">"</span><span class="bp">$HOME</span><span class="s2">/Documents/WindowsPowerShell/Modules;"</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nv">$</span><span class="nn">env</span><span class="p">:</span><span class="nv">PSModulePath</span><span class="p">,</span><span class="w"> </span><span class="s2">"Machine"</span><span class="p">)</span><span class="w">
</span></code></pre></div></div>
<h3 id="vssetup-module">VSSetup Module</h3>
<p>In PowerShell as Administrator:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Install-Module</span><span class="w"> </span><span class="nx">VSSetup</span><span class="w"> </span><span class="nt">-Scope</span><span class="w"> </span><span class="nx">CurrentUser</span><span class="w">
</span></code></pre></div></div>
<p>Close and reopen PowerShell. Now you can use the VSSetup commands.</p>
<p>List the Visual Studio installations:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Get-VSSetupInstance</span><span class="w">
</span></code></pre></div></div>
<p>This finds the installation path for Visual Studio 2022:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Get-VSSetupInstance</span><span class="w"> </span><span class="se">`
</span><span class="o">|</span><span class="w"> </span><span class="n">Select-VSSetupInstance</span><span class="w"> </span><span class="nt">-Version</span><span class="w"> </span><span class="s1">'[17.0,]'</span><span class="w"> </span><span class="se">`
</span><span class="o">|</span><span class="w"> </span><span class="n">Select-Object</span><span class="w"> </span><span class="nt">-ExpandProperty</span><span class="w"> </span><span class="nx">InstallationPath</span><span class="w">
</span></code></pre></div></div>
<p>See <a href="https://github.com/Microsoft/vssetup.powershell/wiki/Selecting-an-Instance">Selecting an Instance</a></p>]]></content><author><name>Primo Software</name></author><category term="cpp" /><category term="windows" /><summary type="html"><![CDATA[These steps were tested on Windows 11, 23H2. Scripts are PowerShell. Visual Studio 2022 This is needed for the C++ compiler. Install Visual Studio 2022 Community Edition. During installation select C++ desktop development and latest Windows 10 and Windows 11 SDKs. After installation open Visual Studio and check for updates. Install the latest 2022 version that is available.]]></summary></entry><entry><title type="html">Getting Started with .NET and Visual Studio Code on Ubuntu</title><link href="/getting-started-net-visual-studio-code-ubuntu/" rel="alternate" type="text/html" title="Getting Started with .NET and Visual Studio Code on Ubuntu" /><published>2023-11-20T00:00:00-08:00</published><updated>2023-11-20T00:00:00-08:00</updated><id>/getting-started-net-visual-studio-code-ubuntu</id><content type="html" xml:base="/getting-started-net-visual-studio-code-ubuntu/"><![CDATA[<p>Before going through these steps make sure you have done <a href="/setup-net-development-environment-ubuntu">Setup .NET development environment on Ubuntu</a></p>
<h2 id="visual-studio-code">Visual Studio Code</h2>
<p>Download and install from <a href="https://code.visualstudio.com/download">Visual Studio Code</a> site.</p>
<p>Open Visual Studio Code and press <code class="language-plaintext highlighter-rouge">Ctrl + Shift + P</code>. Select <code class="language-plaintext highlighter-rouge">Shell Command: Install 'code' command in PATH</code>.</p>
<p>Close Visual Studio Code.</p>
<h2 id="project-directory">Project Directory</h2>
<p>Create a directory called <code class="language-plaintext highlighter-rouge">simple</code> in <code class="language-plaintext highlighter-rouge">~/net/simple</code></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> <span class="nt">-p</span> ~/net/simple
</code></pre></div></div>
<h2 id="net-project-files">.NET Project Files</h2>
<p>Create the project files:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$HOME</span><span class="s2">/.dotnet:</span><span class="nv">$PATH</span><span class="s2">"</span>
<span class="nb">cd</span> ~/net/simple
<span class="c"># Switch to use .NET SDK 6.0, 7.0 or 8.0. We do 8.0 here but give the commands for other versions </span>
<span class="c"># dotnet new globaljson --sdk-version 6.0.417 --roll-forward latestPatch</span>
<span class="c"># dotnet new globaljson --sdk-version 7.0.404 --roll-forward latestPatch</span>
dotnet new globaljson <span class="nt">--sdk-version</span> 8.0.100 <span class="nt">--roll-forward</span> latestPatch
<span class="c"># create new console application and project</span>
dotnet new console <span class="nt">--framework</span> net6.0
<span class="c"># create new solution and add the project to it</span>
dotnet new sln
dotnet sln add simple.csproj
<span class="c"># add .gitignore</span>
dotnet new gitignore
</code></pre></div></div>
<p>Open the directory in Visual Studio Code:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$HOME</span><span class="s2">/.dotnet:</span><span class="nv">$PATH</span><span class="s2">"</span>
<span class="nb">cd</span> ~/net/simple
code <span class="nb">.</span>
</code></pre></div></div>
<p>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit">C# Dev Kit extension</a> for Visual Studio Code.</p>
<h2 id="automate-the-build">Automate the build</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodetasksjson"><code class="language-plaintext highlighter-rouge">.vscode/tasks.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2.0.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tasks"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet"</span><span class="p">,</span><span class="w">
</span><span class="nl">"task"</span><span class="p">:</span><span class="w"> </span><span class="s2">"build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"group"</span><span class="p">:</span><span class="w"> </span><span class="s2">"build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"problemMatcher"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
</span><span class="nl">"label"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet: build"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>Test the build by pressing <code class="language-plaintext highlighter-rouge">Ctrl + Shift + B</code>. Visual Studio Code should execute the <code class="language-plaintext highlighter-rouge">build.sh</code> script automatically.</p>
<h2 id="setup-debugging">Setup Debugging</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodelaunchjson"><code class="language-plaintext highlighter-rouge">.vscode/launch.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.2.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"configurations"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">".NET Core Launch (console)"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"coreclr"</span><span class="p">,</span><span class="w">
</span><span class="nl">"request"</span><span class="p">:</span><span class="w"> </span><span class="s2">"launch"</span><span class="p">,</span><span class="w">
</span><span class="nl">"preLaunchTask"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet: build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"program"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}/bin/Debug/net6.0/simple.dll"</span><span class="p">,</span><span class="w">
</span><span class="nl">"args"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
</span><span class="nl">"cwd"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"console"</span><span class="p">:</span><span class="w"> </span><span class="s2">"internalConsole"</span><span class="p">,</span><span class="w">
</span><span class="nl">"stopAtEntry"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<h2 id="test-the-debugging">Test the debugging</h2>
<p>Set a breakpoint at the <code class="language-plaintext highlighter-rouge">Console.WriteLine("Hello, World!");</code> line in <code class="language-plaintext highlighter-rouge">Programs.cs</code>:</p>
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// See https://aka.ms/new-console-template for more information</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">"Hello, World!"</span><span class="p">);</span>
</code></pre></div></div>
<p>Press <code class="language-plaintext highlighter-rouge">F5</code> to launch the debugger. It should stop at the breakpoint.</p>]]></content><author><name>Primo Software</name></author><category term="csharp" /><category term="vscode" /><category term="dotnet" /><category term="linux" /><category term="ubuntu" /><summary type="html"><![CDATA[Before going through these steps make sure you have done Setup .NET development environment on Ubuntu Visual Studio Code Download and install from Visual Studio Code site. Open Visual Studio Code and press Ctrl + Shift + P. Select Shell Command: Install 'code' command in PATH. Close Visual Studio Code.]]></summary></entry><entry><title type="html">Setup .NET development environment on Ubuntu</title><link href="/setup-net-development-environment-ubuntu/" rel="alternate" type="text/html" title="Setup .NET development environment on Ubuntu" /><published>2023-11-19T00:00:00-08:00</published><updated>2023-11-19T00:00:00-08:00</updated><id>/setup-net-development-environment-ubuntu</id><content type="html" xml:base="/setup-net-development-environment-ubuntu/"><![CDATA[<h1 id="setup-for-ubuntu">Setup for Ubuntu</h1>
<p>Download the <code class="language-plaintext highlighter-rouge">dotnet-install.sh</code> script</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd
</span>curl <span class="nt">-sSL</span> https://dot.net/v1/dotnet-install.sh <span class="o">></span> dotnet-install.sh
<span class="nb">chmod</span> +x dotnet-install.sh
</code></pre></div></div>
<h2 id="net-runtime">.NET Runtime</h2>
<h3 id="net-runtime-60-lts">.NET Runtime 6.0 (LTS)</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh --runtime dotnet --channel 6.0 --version latest
</code></pre></div></div>
<h3 id="net-runtime-70">.NET Runtime 7.0</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh --runtime dotnet --channel 7.0 --version latest
</code></pre></div></div>
<h3 id="net-runtime-80-lts">.NET Runtime 8.0 (LTS)</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh --runtime dotnet --channel 8.0 --version latest
</code></pre></div></div>
<h2 id="net-sdk">.NET SDK</h2>
<h3 id="net-sdk-60">.NET SDK 6.0</h3>
<p>This is needed by the Visual Studio Code C# extension. Install with <code class="language-plaintext highlighter-rouge">dotnet-install.sh</code> script:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh <span class="nt">--channel</span> 6.0
</code></pre></div></div>
<h3 id="net-sdk-70">.NET SDK 7.0</h3>
<p>This is needed by the Visual Studio Code C# extension. Install with <code class="language-plaintext highlighter-rouge">dotnet-install.sh</code> script:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh <span class="nt">--channel</span> 7.0
</code></pre></div></div>
<h3 id="net-sdk-80">.NET SDK 8.0</h3>
<p>Install with <code class="language-plaintext highlighter-rouge">dotnet-install.sh</code> script:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh <span class="nt">--channel</span> 8.0
</code></pre></div></div>
<h2 id="test">Test</h2>
<p>Test that you can run the <code class="language-plaintext highlighter-rouge">dotnet</code> CLI (command line interface)</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>~/.dotnet/dotnet <span class="nt">--version</span>
~/.dotnet/dotnet new console <span class="nt">--help</span>
</code></pre></div></div>]]></content><author><name>Primo Software</name></author><category term="csharp" /><category term="dotnet" /><category term="linux" /><category term="ubuntu" /><summary type="html"><![CDATA[Setup for Ubuntu Download the dotnet-install.sh script cd curl -sSL https://dot.net/v1/dotnet-install.sh > dotnet-install.sh chmod +x dotnet-install.sh]]></summary></entry><entry><title type="html">Getting Started with C++ and Visual Studio Code on Ubuntu</title><link href="/getting-started-cpp-visual-studio-code-ubuntu/" rel="alternate" type="text/html" title="Getting Started with C++ and Visual Studio Code on Ubuntu" /><published>2023-11-18T00:00:00-08:00</published><updated>2023-11-18T00:00:00-08:00</updated><id>/getting-started-cpp-visual-studio-code-ubuntu</id><content type="html" xml:base="/getting-started-cpp-visual-studio-code-ubuntu/"><![CDATA[<p>Before going through these steps make sure you have done <a href="/setup-cpp-development-environment-ubuntu">Setup C++ development environment on Ubuntu</a></p>
<h2 id="visual-studio-code">Visual Studio Code</h2>
<p>Download and install from <a href="https://code.visualstudio.com/download">Visual Studio Code</a> site.</p>
<p>Open Visual Studio Code and press <code class="language-plaintext highlighter-rouge">Cmd + Shift + P</code>. Select <code class="language-plaintext highlighter-rouge">Shell Command: Install 'code' command in PATH</code>.</p>
<h2 id="c-project">C++ Project</h2>
<p>Create a directory called simple in <code class="language-plaintext highlighter-rouge">~/cpp/simple</code></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> <span class="nt">-p</span> ~/cpp/simple
</code></pre></div></div>
<p>Open the directory in Visual Studio Code:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd</span> ~/cpp/simple
code <span class="nb">.</span>
</code></pre></div></div>
<p>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack">C/C++ Extension Pack</a>.</p>
<h2 id="project-files">Project Files</h2>
<p>Add the following files:</p>
<h3 id="srcmaincpp"><code class="language-plaintext highlighter-rouge">src/main.cpp</code></h3>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include</span> <span class="cpf"><iostream></span><span class="cp">
</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
<span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o"><<</span> <span class="s">"Hello CMake!</span><span class="se">\n</span><span class="s">"</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div></div>
<h3 id="cmakeliststxt"><code class="language-plaintext highlighter-rouge">CMakeLists.txt</code></h3>
<div class="language-cmake highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cmake_minimum_required</span><span class="p">(</span>VERSION 3.20<span class="p">)</span>
<span class="nb">project</span><span class="p">(</span>simple<span class="p">)</span>
<span class="nb">add_executable</span><span class="p">(</span>simple src/main.cpp<span class="p">)</span>
</code></pre></div></div>
<h3 id="buildsh"><code class="language-plaintext highlighter-rouge">build.sh</code></h3>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/usr/bin/env bash</span>
<span class="nb">mkdir</span> <span class="nt">-p</span> ./build/debug
<span class="nb">pushd</span> ./build/debug
cmake <span class="nt">-G</span> <span class="s1">'Ninja'</span> <span class="nt">-DCMAKE_BUILD_TYPE</span><span class="o">=</span>Debug ../.. <span class="o">&&</span> <span class="se">\</span>
ninja
<span class="nv">ret</span><span class="o">=</span><span class="nv">$?</span>
<span class="nb">popd</span>
</code></pre></div></div>
<p>Make it executable:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">chmod</span> +x build.sh
</code></pre></div></div>
<h3 id="gitignore"><code class="language-plaintext highlighter-rouge">.gitignore</code></h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>.cache/
build/
</code></pre></div></div>
<h2 id="test-the-build">Test the build</h2>
<p>Open Terminal in Visual Studio Code and test the build from command line:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./build.sh
</code></pre></div></div>
<h2 id="automate-the-build">Automate the build</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodetasksjson"><code class="language-plaintext highlighter-rouge">.vscode/tasks.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2.0.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tasks"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"label"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"shell"</span><span class="p">,</span><span class="w">
</span><span class="nl">"linux"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"command"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}/build.sh"</span><span class="p">,</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"group"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"kind"</span><span class="p">:</span><span class="w"> </span><span class="s2">"build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"isDefault"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>Test the build by pressing <code class="language-plaintext highlighter-rouge">Ctrl + Shift + B</code>. Visual Studio Code should execute the <code class="language-plaintext highlighter-rouge">build.sh</code> script automatically.</p>
<h2 id="setup-debugging">Setup Debugging</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodelaunchjson"><code class="language-plaintext highlighter-rouge">.vscode/launch.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.2.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"configurations"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Launch (gdb)"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"cppdbg"</span><span class="p">,</span><span class="w">
</span><span class="nl">"request"</span><span class="p">:</span><span class="w"> </span><span class="s2">"launch"</span><span class="p">,</span><span class="w">
</span><span class="nl">"cwd"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"linux"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"program"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}/build/debug/simple"</span><span class="p">,</span><span class="w">
</span><span class="nl">"MIMode"</span><span class="p">:</span><span class="w"> </span><span class="s2">"gdb"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<h2 id="test-the-debugging">Test the debugging</h2>
<p>Set a breakpoint on the first line of <code class="language-plaintext highlighter-rouge">int main()</code> inside <code class="language-plaintext highlighter-rouge">src/main.cpp</code>. Press <code class="language-plaintext highlighter-rouge">F5</code> to launch the debugger. It should stop at the breakpoint.</p>]]></content><author><name>Primo Software</name></author><category term="vscode" /><category term="cpp" /><category term="linux" /><category term="ubuntu" /><summary type="html"><![CDATA[Before going through these steps make sure you have done Setup C++ development environment on Ubuntu Visual Studio Code Download and install from Visual Studio Code site. Open Visual Studio Code and press Cmd + Shift + P. Select Shell Command: Install 'code' command in PATH.]]></summary></entry><entry><title type="html">Setup C++ development environment on Ubuntu</title><link href="/setup-cpp-development-environment-ubuntu/" rel="alternate" type="text/html" title="Setup C++ development environment on Ubuntu" /><published>2023-11-17T00:00:00-08:00</published><updated>2023-11-17T00:00:00-08:00</updated><id>/setup-cpp-development-environment-ubuntu</id><content type="html" xml:base="/setup-cpp-development-environment-ubuntu/"><![CDATA[<p>These steps were tested on Ubuntu 22.04.3 LTS. Scripts are <code class="language-plaintext highlighter-rouge">bash</code>.</p>
<h3 id="compilers">Compilers</h3>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>build-essential
</code></pre></div></div>
<h3 id="cmake">CMake</h3>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>cmake
</code></pre></div></div>
<h3 id="ninja">ninja</h3>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>ninja-build
</code></pre></div></div>]]></content><author><name>Primo Software</name></author><category term="cpp" /><category term="linux" /><category term="ubuntu" /><summary type="html"><![CDATA[These steps were tested on Ubuntu 22.04.3 LTS. Scripts are bash. Compilers sudo apt install build-essential]]></summary></entry><entry><title type="html">Getting Started with .NET and Visual Studio Code on macOS</title><link href="/getting-started-net-visual-studio-code-macos/" rel="alternate" type="text/html" title="Getting Started with .NET and Visual Studio Code on macOS" /><published>2023-11-15T00:00:00-08:00</published><updated>2023-11-15T00:00:00-08:00</updated><id>/getting-started-net-visual-studio-code-macos</id><content type="html" xml:base="/getting-started-net-visual-studio-code-macos/"><![CDATA[<p>Before going through these steps make sure you have done <a href="/setup-net-development-environment-macos">Setup .NET development environment on macOS</a></p>
<h2 id="visual-studio-code">Visual Studio Code</h2>
<p>Download and install from <a href="https://code.visualstudio.com/download">Visual Studio Code</a> site.</p>
<p>Open Visual Studio Code and press <code class="language-plaintext highlighter-rouge">Cmd + Shift + P</code>. Select <code class="language-plaintext highlighter-rouge">Shell Command: Install 'code' command in PATH</code>.</p>
<p>Close Visual Studio Code.</p>
<h2 id="project-directory">Project Directory</h2>
<p>Create a directory called <code class="language-plaintext highlighter-rouge">simple</code> in <code class="language-plaintext highlighter-rouge">~/net/simple</code></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> <span class="nt">-p</span> ~/net/simple
</code></pre></div></div>
<h2 id="net-project-files">.NET Project Files</h2>
<p>Create the project files:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$HOME</span><span class="s2">/.dotnet:</span><span class="nv">$PATH</span><span class="s2">"</span>
<span class="nb">cd</span> ~/net/simple
<span class="c"># Switch to use .NET SDK 6.0, 7.0 or 8.0. We do 8.0 here but give the commands for other versions </span>
<span class="c"># dotnet new globaljson --sdk-version 6.0.417 --roll-forward latestPatch</span>
<span class="c"># dotnet new globaljson --sdk-version 7.0.404 --roll-forward latestPatch</span>
dotnet new globaljson <span class="nt">--sdk-version</span> 8.0.100 <span class="nt">--roll-forward</span> latestPatch
<span class="c"># create new console application and project</span>
dotnet new console <span class="nt">--framework</span> net6.0
<span class="c"># create new solution and add the project to it</span>
dotnet new sln
dotnet sln add simple.csproj
<span class="c"># add .gitignore</span>
dotnet new gitignore
</code></pre></div></div>
<p>Open the directory in Visual Studio Code:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$HOME</span><span class="s2">/.dotnet:</span><span class="nv">$PATH</span><span class="s2">"</span>
<span class="nb">cd</span> ~/net/simple
code <span class="nb">.</span>
</code></pre></div></div>
<p>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit">C# Dev Kit extension</a> for Visual Studio Code.</p>
<h2 id="automate-the-build">Automate the build</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodetasksjson"><code class="language-plaintext highlighter-rouge">.vscode/tasks.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2.0.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tasks"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet"</span><span class="p">,</span><span class="w">
</span><span class="nl">"task"</span><span class="p">:</span><span class="w"> </span><span class="s2">"build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"group"</span><span class="p">:</span><span class="w"> </span><span class="s2">"build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"problemMatcher"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
</span><span class="nl">"label"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet: build"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>Test the build by pressing <code class="language-plaintext highlighter-rouge">Cmd + Shift + B</code>. Visual Studio Code should execute the <code class="language-plaintext highlighter-rouge">build.sh</code> script automatically.</p>
<h2 id="setup-debugging">Setup Debugging</h2>
<p>Add the following Visual Studio Code specific files to the <code class="language-plaintext highlighter-rouge">.vscode</code> subdir:</p>
<h3 id="vscodelaunchjson"><code class="language-plaintext highlighter-rouge">.vscode/launch.json</code></h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.2.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"configurations"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">".NET Core Launch (console)"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"coreclr"</span><span class="p">,</span><span class="w">
</span><span class="nl">"request"</span><span class="p">:</span><span class="w"> </span><span class="s2">"launch"</span><span class="p">,</span><span class="w">
</span><span class="nl">"preLaunchTask"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dotnet: build"</span><span class="p">,</span><span class="w">
</span><span class="nl">"program"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}/bin/Debug/net6.0/simple.dll"</span><span class="p">,</span><span class="w">
</span><span class="nl">"args"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
</span><span class="nl">"cwd"</span><span class="p">:</span><span class="w"> </span><span class="s2">"${workspaceFolder}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"console"</span><span class="p">:</span><span class="w"> </span><span class="s2">"internalConsole"</span><span class="p">,</span><span class="w">
</span><span class="nl">"stopAtEntry"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<h2 id="test-the-debugging">Test the debugging</h2>
<p>Set a breakpoint at the <code class="language-plaintext highlighter-rouge">Console.WriteLine("Hello, World!");</code> line in <code class="language-plaintext highlighter-rouge">Programs.cs</code>:</p>
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// See https://aka.ms/new-console-template for more information</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">"Hello, World!"</span><span class="p">);</span>
</code></pre></div></div>
<p>Press <code class="language-plaintext highlighter-rouge">F5</code> to launch the debugger. It should stop at the breakpoint.</p>]]></content><author><name>Primo Software</name></author><category term="csharp" /><category term="vscode" /><category term="dotnet" /><category term="macos" /><summary type="html"><![CDATA[Before going through these steps make sure you have done Setup .NET development environment on macOS Visual Studio Code Download and install from Visual Studio Code site. Open Visual Studio Code and press Cmd + Shift + P. Select Shell Command: Install 'code' command in PATH. Close Visual Studio Code.]]></summary></entry><entry><title type="html">Setup .NET development environment on macOS</title><link href="/setup-net-development-environment-macos/" rel="alternate" type="text/html" title="Setup .NET development environment on macOS" /><published>2023-11-14T00:00:00-08:00</published><updated>2023-11-14T00:00:00-08:00</updated><id>/setup-net-development-environment-macos</id><content type="html" xml:base="/setup-net-development-environment-macos/"><![CDATA[<h1 id="setup-for-macos">Setup for macOS</h1>
<p>Download the <code class="language-plaintext highlighter-rouge">dotnet-install.sh</code> script</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd
</span>curl <span class="nt">-sSL</span> https://dot.net/v1/dotnet-install.sh <span class="o">></span> dotnet-install.sh
<span class="nb">chmod</span> +x dotnet-install.sh
</code></pre></div></div>
<h2 id="net-runtime">.NET Runtime</h2>
<h3 id="net-runtime-60-lts">.NET Runtime 6.0 (LTS)</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh --runtime dotnet --channel 6.0 --version latest
</code></pre></div></div>
<p>or download and install from <a href="https://dotnet.microsoft.com/en-us/download/dotnet/6.0">Microsoft</a></p>
<h3 id="net-runtime-70">.NET Runtime 7.0</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh --runtime dotnet --channel 7.0 --version latest
</code></pre></div></div>
<p>or download and install from <a href="https://dotnet.microsoft.com/en-us/download/dotnet/7.0">Microsoft</a></p>
<h3 id="net-runtime-80-lts">.NET Runtime 8.0 (LTS)</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh --runtime dotnet --channel 8.0 --version latest
</code></pre></div></div>
<p>or download and install from <a href="https://dotnet.microsoft.com/en-us/download/dotnet/8.0">Microsoft</a></p>
<h2 id="net-sdk">.NET SDK</h2>
<h3 id="net-sdk-60">.NET SDK 6.0</h3>
<p>This is needed by the Visual Studio Code C# extension. Install with <code class="language-plaintext highlighter-rouge">dotnet-install.sh</code> script:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh <span class="nt">--channel</span> 6.0
</code></pre></div></div>
<h3 id="net-sdk-70">.NET SDK 7.0</h3>
<p>This is needed by the Visual Studio Code C# extension. Install with <code class="language-plaintext highlighter-rouge">dotnet-install.sh</code> script:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh <span class="nt">--channel</span> 7.0
</code></pre></div></div>
<h3 id="net-sdk-80">.NET SDK 8.0</h3>
<p>Install with <code class="language-plaintext highlighter-rouge">dotnet-install.sh</code> script:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./dotnet-install.sh <span class="nt">--channel</span> 8.0
</code></pre></div></div>
<h2 id="test">Test</h2>
<p>Test that you can run the <code class="language-plaintext highlighter-rouge">dotnet</code> CLI (command line interface)</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>~/.dotnet/dotnet <span class="nt">--version</span>
~/.dotnet/dotnet new console <span class="nt">--help</span>
</code></pre></div></div>]]></content><author><name>Primo Software</name></author><category term="csharp" /><category term="dotnet" /><category term="macos" /><summary type="html"><![CDATA[Setup for macOS Download the dotnet-install.sh script cd curl -sSL https://dot.net/v1/dotnet-install.sh > dotnet-install.sh chmod +x dotnet-install.sh]]></summary></entry></feed>