{"id":2315,"date":"2022-03-10T17:14:43","date_gmt":"2022-03-10T09:14:43","guid":{"rendered":"https:\/\/guerilla.ddns.net\/wp\/?page_id=2315"},"modified":"2025-09-10T08:30:55","modified_gmt":"2025-09-10T00:30:55","slug":"%e5%9c%a8-ubuntu-%e4%b8%8b%ef%bc%8c%e7%94%a8-visual-studio-code-%e7%b5%90%e5%90%88-glade-%e4%be%86%e7%94%a2%e7%94%9f-net-core-c-gtk3-gtk-%e7%9a%84%e7%a8%8b%e5%bc%8f","status":"publish","type":"page","link":"https:\/\/guerilla.ddns.net\/wp\/?page_id=2315","title":{"rendered":"\u5728 Ubuntu 24.04 \u4e0b\uff0c\u7528 Visual Studio Code \u7d50\u5408 Glade \u4f86\u7522\u751f .Net Core, C#, GTK-Sharp 3 \u7684\u7a0b\u5f0f"},"content":{"rendered":"<h3>\u70ba Ubuntu 24.04 \u5b89\u88dd Visual Studio Code (vscode), .NET (dotnet), GTK# (GtkSharp)<\/h3>\n<p>&nbsp;<br \/>\n<strong>install Visual Studio Code<\/strong><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">wget -qO- https:\/\/packages.microsoft.com\/keys\/microsoft.asc | gpg --dearmor &gt; packages.microsoft.gpg<\/code><\/pre>\n<pre><code class=\"language-bash\" data-line=\"\">sudo install -D -o root -g root -m 644 packages.microsoft.gpg \/etc\/apt\/keyrings\/packages.microsoft.gpg<\/code><\/pre>\n<pre><code class=\"language-bash\" data-line=\"\">sudo sh -c &#039;echo &quot;deb [arch=amd64,arm64,armhf signed-by=\/etc\/apt\/keyrings\/packages.microsoft.gpg] https:\/\/packages.microsoft.com\/repos\/code stable main&quot; &gt; \/etc\/apt\/sources.list.d\/vscode.list&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\" data-line=\"\">rm -f packages.microsoft.gpg<\/code><\/pre>\n<pre><code class=\"language-bash\" data-line=\"\">sudo apt update<\/code><\/pre>\n<pre><code class=\"language-bash\" data-line=\"\">sudo apt install code<\/code><\/pre>\n<p>&nbsp;<br \/>\n<strong>install .NET 8 SDK<\/strong><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">sudo apt update &amp;&amp; sudo apt install -y dotnet-sdk-8.0<\/code><\/pre>\n<p>&nbsp;<br \/>\n<strong>install GTK# 3<\/strong><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">sudo apt install -y gtk-sharp3<\/code><\/pre>\n<p><small>ps: \u5982\u679c\u6709\u5b89\u88dd gtk-sharp3-examples, \u9019\u4e9b\u7bc4\u4f8b\u5728 \/usr\/share\/gtk-sharp3-examples<\/small><br \/>\n&nbsp;<br \/>\n<!-- \u958b\u500b terminal <kbd>Ctrl<\/kbd>+<kbd>Alt<\/kbd>+<kbd>T<\/kbd>\u57f7\u884c --><\/p>\n<h3>\u70ba .NET sdk \u5b89\u88dd gtkapp \u6a23\u677f (template)<\/h3>\n<p>&nbsp;<br \/>\n\u6aa2\u67e5\u6709\u6c92\u6709 .NET SDK \u6709\u6c92\u6709 <strong>gtkapp<\/strong> \u6a23\u677f (template)<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">dotnet new list<\/code><\/pre>\n<p>&nbsp;<br \/>\n\u6c92\u6709\u7684\u8a71\u8981\u5b89\u88dd template<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">dotnet new install &quot;GtkSharp.Template.CSharp&quot;<\/code><\/pre>\n<p>&nbsp;<br \/>\n\u4e4b\u5f8c\uff0c\u8981\u7522\u751f\u65b0\u7684 GtkSharp \u5c08\u6848\uff0c\u5c31\u53ea\u8981<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">dotnet new gtkapp<\/code><\/pre>\n<p>\u5c31\u6703\u6709\u500b\u7c21\u55ae\u7684 GtkSharp \u5c08\u6848\u8dd1\u51fa\u4f86\u5537<br \/>\n&nbsp;<br \/>\n\u6ce8\u610f .csproj \u5c08\u6848\u6a94\u88e1\u982d\u7684\u5167\u5bb9<\/p>\n<pre><code class=\"\" data-line=\"\">&lt;TargetFramework&gt;net6.0&lt;\/TargetFramework&gt;<\/code><\/pre>\n<p>\u53ef\u4ee5\u6307\u5b9a\u7a0b\u5f0f\u4f7f\u7528\u4e0d\u540c\u7248\u672c\u7684 .NET (\u9810\u8a2d\u662f 6.0)<br \/>\n&nbsp;<br \/>\n\u7528\u9019\u500b\u6307\u4ee4\u53ef\u4ee5\u5217\u51fa\u7cfb\u7d71\u5b89\u88dd\u4e86\u54ea\u4e9b .NET SDK<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">dotnet --list-sdks<\/code><\/pre>\n<p>&nbsp;<br \/>\n<!--\n\u5728\u5c08\u6848\u7684\u6839\u76ee\u9304\u4e0b\u57f7\u884c\n\n\n<pre><code class=\"language-bash\" data-line=\"\">dotnet new globaljson<\/code><\/pre>\n\n\n&nbsp;\n\u7522\u751f\u51fa\u4f86\u7684 global.json \u6a94\u6848\u5167\u5bb9\u6703\u50cf\u9019\u6a23\n\n\n<pre><code class=\"language-json\" data-line=\"\">{\n  &quot;sdk&quot;: {\n    &quot;version&quot;: &quot;8.0.119&quot;\n  }\n}<\/code><\/pre>\n\n\n&nbsp;\n\u82e5\u5c08\u6848\u7684\u6839\u76ee\u9304\u6709 global.json\uff0c\u518d\u7528 dotnet new ... \u7522\u751f\u5c08\u6848\uff0c\u5247\u5c08\u6848\u5c31\u6703\u4ee5 global.json \u88e1\u7684 version \u70ba\u6307\u5b9a\u7248\u672c\u3002(ps: dotnet new gtkapp \u9084\u662f\u4e00\u6a23 net6.0, \u8981\u624b\u52d5\u6539\u6210 8.0)\n&nbsp;\n--><\/p>\n<h3>\u5b89\u88dd Glade<\/h3>\n<p>&nbsp;<br \/>\n\u5b89\u88dd <strong>Glade<\/strong>:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">sudo apt install glade<\/code><\/pre>\n<p>&nbsp;<br \/>\n\u5b89\u88dd\u5f8c\u53ef\u4ee5\u958b .glade \u6a94<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">glade PATH-TO-GLADE-FILE<\/code><\/pre>\n<p>&nbsp;<br \/>\nps: \u60f3\u77e5\u9053 glade \u5b89\u88dd\u5230\u54ea\u500b\u5730\u65b9\uff0c\u53ef\u4ee5\u57f7\u884c <\/p>\n<pre><code class=\"language-bash\" data-line=\"\">type glade<\/code><\/pre>\n<p> \u6216 <\/p>\n<pre><code class=\"language-bash\" data-line=\"\">which glade<\/code><\/pre>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\nRef:<br \/>\n\u2022 <a href=\"https:\/\/code.visualstudio.com\/docs\/setup\/linux\" rel=\"noopener\" target=\"_blank\"><em>Visual Studio Code on Linux<\/em><\/a><br \/>\n\u2022 <a href=\"https:\/\/teonotebook.wordpress.com\/2019\/03\/17\/cross-platform-gui-application-development-with-vscode-c-gtk3-gtksharp-and-glade\/\" target=\"_blank\" rel=\"noopener\"><em>Cross platform GUI application development with VSCode, .Net Core, C#, gtk3, gtksharp and Glade<\/em><\/a><br \/>\n&nbsp;<br \/>\n#linux #ubuntu #vscode #glade #dotnet #.net #c# #gtk3 #gtk#<br \/>\n&nbsp;<\/p>\n<p style=\"text-align: right;\">2025\/9\/10<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u70ba Ubuntu 24.04 \u5b89\u88dd Visual Studio Code (vscode), .NET (do [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2315","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/pages\/2315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2315"}],"version-history":[{"count":37,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/pages\/2315\/revisions"}],"predecessor-version":[{"id":3559,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/pages\/2315\/revisions\/3559"}],"wp:attachment":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}