マイクロソフト系技術情報 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。

目次

概要

準備

WSL

インストール

コチラを参照。

設定

Installing, this may take a few minutes...
Installation successful!
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: seigi
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Default UNIX user set to: seigi
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

dotnet

2.n

sudo apt-get update
sudo apt-get install openssh-server unzip curl
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install dotnet-sdk-2.n
dotnet --version

3.n

...

.NET Coreの開発

dotnet new

dotnet new コマンドを使用した、テンプレート準備とビルド・実行。

seigi@nishino:~$ curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   983  100   983    0     0    319      0  0:00:03  0:00:03 --:--:--   319
seigi@nishino:~$ sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
[sudo] password for seigi:
seigi@nishino:~$ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
seigi@nishino:~$ sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:3 https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial InRelease [2,845 B]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7,532 kB]
Get:7 https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial/main amd64 Packages [38.1 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [484 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [209 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [7,224 B]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/restricted Translation-en [2,152 B]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [344 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/universe Translation-en [4,354 kB]
Get:14 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [129 kB]
Get:15 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3,464 B]
Get:16 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [1,744 B]
Get:17 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [769 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [319 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [7,560 B]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2,272 B]
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [624 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [252 kB]
Get:25 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.4 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8,344 B]
Get:27 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4,844 B]
Get:28 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [3,220 B]
Get:29 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [7,400 B]
Get:30 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [3,996 B]
Fetched 15.7 MB in 16s (944 kB/s)
Reading package lists... Done
seigi@nishino:~$ sudo apt-get install dotnet-sdk-2.0.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  aspnetcore-store-2.0.0 dotnet-host dotnet-hostfxr-2.0.0 dotnet-runtime-2.0.0 dotnet-runtime-deps-2.1.0-rc1 libcurl3
  liblttng-ust-ctl2 liblttng-ust0 libunwind8 liburcu4
The following NEW packages will be installed:
  aspnetcore-store-2.0.0 dotnet-host dotnet-hostfxr-2.0.0 dotnet-runtime-2.0.0 dotnet-runtime-deps-2.1.0-rc1
  dotnet-sdk-2.0.0 libcurl3 liblttng-ust-ctl2 liblttng-ust0 libunwind8 liburcu4
0 upgraded, 11 newly installed, 0 to remove and 135 not upgraded.
Need to get 108 MB of archives.
After this operation, 309 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu xenial/universe amd64 liburcu4 amd64 0.9.1-3 [47.3 kB]
Get:2 https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial/main amd64 aspnetcore-store-2.0.0 amd64 2.0.0-1 [18.1 MB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/universe amd64 liblttng-ust-ctl2 amd64 2.7.1-1 [72.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/universe amd64 liblttng-ust0 amd64 2.7.1-1 [127 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcurl3 amd64 7.47.0-1ubuntu2.7 [187 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 libunwind8 amd64 1.1-4.1 [46.5 kB]
Get:7 https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial/main amd64 dotnet-runtime-deps-2.1.0-rc1 amd64 2.1.0-rc1-1 [2,622 B]
Get:8 https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial/main amd64 dotnet-host amd64 2.1.0-rc1-1 [34.4 kB]
Get:9 https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial/main amd64 dotnet-hostfxr-2.0.0 amd64 2.0.0-1 [135 kB]
Get:10 https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial/main amd64 dotnet-runtime-2.0.0 amd64 2.0.0-1 [18.6 MB]
Get:11 https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial/main amd64 dotnet-sdk-2.0.0 amd64 2.0.0-1 [70.3 MB]
Fetched 108 MB in 1min 39s (1,078 kB/s)
Selecting previously unselected package aspnetcore-store-2.0.0.
(Reading database ... 25532 files and directories currently installed.)
Preparing to unpack .../aspnetcore-store-2.0.0_2.0.0-1_amd64.deb ...
Unpacking aspnetcore-store-2.0.0 (2.0.0-1) ...
Selecting previously unselected package liburcu4:amd64.
Preparing to unpack .../liburcu4_0.9.1-3_amd64.deb ...
Unpacking liburcu4:amd64 (0.9.1-3) ...
Selecting previously unselected package liblttng-ust-ctl2:amd64.
Preparing to unpack .../liblttng-ust-ctl2_2.7.1-1_amd64.deb ...
Unpacking liblttng-ust-ctl2:amd64 (2.7.1-1) ...
Selecting previously unselected package liblttng-ust0:amd64.
Preparing to unpack .../liblttng-ust0_2.7.1-1_amd64.deb ...
Unpacking liblttng-ust0:amd64 (2.7.1-1) ...
Selecting previously unselected package dotnet-runtime-deps-2.1.0-rc1.
Preparing to unpack .../dotnet-runtime-deps-2.1.0-rc1_2.1.0-rc1-1_amd64.deb ...
Unpacking dotnet-runtime-deps-2.1.0-rc1 (2.1.0-rc1-1) ...
Selecting previously unselected package dotnet-host.
Preparing to unpack .../dotnet-host_2.1.0-rc1-1_amd64.deb ...
Unpacking dotnet-host (2.1.0-rc1-1) ...
Selecting previously unselected package dotnet-hostfxr-2.0.0.
Preparing to unpack .../dotnet-hostfxr-2.0.0_2.0.0-1_amd64.deb ...
Unpacking dotnet-hostfxr-2.0.0 (2.0.0-1) ...
Selecting previously unselected package libcurl3:amd64.
Preparing to unpack .../libcurl3_7.47.0-1ubuntu2.7_amd64.deb ...
Unpacking libcurl3:amd64 (7.47.0-1ubuntu2.7) ...
Selecting previously unselected package libunwind8.
Preparing to unpack .../libunwind8_1.1-4.1_amd64.deb ...
Unpacking libunwind8 (1.1-4.1) ...
Selecting previously unselected package dotnet-runtime-2.0.0.
Preparing to unpack .../dotnet-runtime-2.0.0_2.0.0-1_amd64.deb ...
Unpacking dotnet-runtime-2.0.0 (2.0.0-1) ...
Selecting previously unselected package dotnet-sdk-2.0.0.
Preparing to unpack .../dotnet-sdk-2.0.0_2.0.0-1_amd64.deb ...
Unpacking dotnet-sdk-2.0.0 (2.0.0-1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up aspnetcore-store-2.0.0 (2.0.0-1) ...
Setting up liburcu4:amd64 (0.9.1-3) ...
Setting up liblttng-ust-ctl2:amd64 (2.7.1-1) ...
Setting up liblttng-ust0:amd64 (2.7.1-1) ...
Setting up dotnet-runtime-deps-2.1.0-rc1 (2.1.0-rc1-1) ...
Setting up dotnet-host (2.1.0-rc1-1) ...
Setting up dotnet-hostfxr-2.0.0 (2.0.0-1) ...
Setting up libcurl3:amd64 (7.47.0-1ubuntu2.7) ...
Setting up libunwind8 (1.1-4.1) ...
Setting up dotnet-runtime-2.0.0 (2.0.0-1) ...
Setting up dotnet-sdk-2.0.0 (2.0.0-1) ...
This software may collect information about you and your use of the software, and send that to Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.

.NET Core Tools Telemetry
--------------
The .NET Core Tools include a telemetry feature that collects usage information. It is important that the .NET Team understands how the tools are being used so that we can improve them.

The data collected is anonymous and will be published in an aggregated form for use by both Microsoft and community engineers under the Creative Commons Attribution License.

The .NET Core Tools telemetry feature is enabled by default. You can opt-out of the telemetry feature by setting an environment variable DOTNET_CLI_TELEMETRY_OPTOUT (for example, 'export' on macOS/Linux, 'set' on Windows) to true (for example, 'true', 1). You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry.

Installation Note
--------------
A command will be run during the install process that will improve project restore speed and enable offline access. It will take up to a minute to complete.
Processing triggers for libc-bin (2.23-0ubuntu9) ...
seigi@nishino:~$ dotnet --version
2.0.0
seigi@nishino:~$ which dotnet
/usr/bin/dotnet
seigi@nishino:~$ dotnet new console

Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.

Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /home/seigi/seigi.csproj...
  Restoring packages for /home/seigi/seigi.csproj...
  Generating MSBuild file /home/seigi/obj/seigi.csproj.nuget.g.props.
  Generating MSBuild file /home/seigi/obj/seigi.csproj.nuget.g.targets.
  Restore completed in 236.36 ms for /home/seigi/seigi.csproj.


Restore succeeded.

seigi@nishino:~$ dotnet publish -f netcoreapp2.0
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  seigi -> /home/seigi/bin/Debug/netcoreapp2.0/seigi.dll
  seigi -> /home/seigi/bin/Debug/netcoreapp2.0/publish/
seigi@nishino:~$ dotnet /home/seigi/bin/Debug/netcoreapp2.0/seigi.dll
Hello World!
seigi@nishino:~$

dotnet publish

Visual Studioで作成したものを「/mnt/c」※ 1 を経由で、

cd /mnt/c/ConsoleApp1/ConsoleApp1
dotnet publish -c Release -r ubuntu.16.04-x64 --self-contained
cd bin/Release/netcoreapp2.0/ubuntu.16.04-x64
dotnet ConsoleApp1.dll
Hello World!

SCD

dotnet

Visual Studioで作成・ビルドしたものを「/mnt/c」※ 1 を経由して実行

dotnet /mnt/c/ConsoleApp1/ConsoleApp1/bin/Debug/netcoreapp2.0/ConsoleApp1.dll
Hello World!

FDD

ASP.NET Coreの開発

dotnet new

dotnet new コマンドを使用した、準備と確認。

seigi@nishino:~$ dotnet new mvc
Creating this template will make changes to existing files:
  Overwrite   seigi.csproj
  Overwrite   Program.cs

Rerun the command and pass --force to accept and create.
seigi@nishino:~$
seigi@nishino:~$ dotnet new mvc --force
The template "ASP.NET Core Web App (Model-View-Controller)" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/template-3pn for details.

Processing post-creation actions...
Running 'dotnet restore' on /home/seigi/seigi.csproj...
  Restoring packages for /home/seigi/seigi.csproj...
  Restoring packages for /home/seigi/seigi.csproj...
  Restore completed in 2.09 sec for /home/seigi/seigi.csproj.
  Generating MSBuild file /home/seigi/obj/seigi.csproj.nuget.g.targets.
  Restore completed in 3.83 sec for /home/seigi/seigi.csproj.


Restore succeeded.

seigi@nishino:~$ dotnet run
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {89022286-2fdf-47e0-85d2-0047907c89b1} may be persisted to storage in unencrypted form.

Hosting environment: Production
Content root path: /home/seigi
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
^CApplication is shutting down...

seigi@nishino:~$
mvcの実行1

dotnet publish

...。

dotnet run

Visual Studioで作成・ビルドしたものを「/mnt/c」※ 1 を経由して実行

seigi@nishino:~$ cd /mnt/c/WebApplication1/WebApplication1/
seigi@nishino:/mnt/c/WebApplication1/WebApplication1$ dotnet run
Using launch settings from /mnt/c/WebApplication1/WebApplication1/Properties/launchSettings.json...
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using '/home/seigi/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
Hosting environment: Development
Content root path: /mnt/c/WebApplication1/WebApplication1
Now listening on: http://localhost:53336
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
      Executing action method WebApplication1.Controllers.HomeController.Index (WebApplication1) with arguments ((null)) - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]
      Executing ViewResult, running view at path /Views/Home/Index.cshtml.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
      Executed action WebApplication1.Controllers.HomeController.Index (WebApplication1) in 6636.097ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/css/site.css
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/lib/bootstrap/dist/css/bootstrap.css
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/lib/jquery/dist/jquery.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 7032.349ms 200 text/html; charset=utf-8
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/lib/jquery/dist/jquery.js'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/lib/jquery/dist/jquery.js'
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/css/site.css'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/css/site.css'
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/lib/bootstrap/dist/css/bootstrap.css'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/lib/bootstrap/dist/css/bootstrap.css'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 544.652ms 200 text/css
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 551.471ms 200 text/css
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 554.874ms 200 application/javascript
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/lib/bootstrap/dist/js/bootstrap.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/js/site.js?v=ji3-IxbEzYWjzzLCGkF1KDjrT2jLbbrSYXw-AhMPNIA
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/lib/bootstrap/dist/js/bootstrap.js'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/lib/bootstrap/dist/js/bootstrap.js'
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/js/site.js'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/js/site.js'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/images/banner1.svg
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/images/banner1.svg'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/images/banner1.svg'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.714ms 200 image/svg+xml
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/images/banner2.svg
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 3.301ms 200 application/javascript
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/images/banner3.svg
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/images/banner2.svg'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/images/banner2.svg'
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/images/banner3.svg'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/images/banner3.svg'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.348ms 200 image/svg+xml
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.485ms 200 image/svg+xml
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/images/banner4.svg
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 6.833ms 200 application/javascript
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/images/banner4.svg'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/images/banner4.svg'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 1.35ms 200 image/svg+xml
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.757ms 200 font/woff2
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:53336/favicon.ico
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
      Sending file. Request path: '/favicon.ico'. Physical path: '/mnt/c/WebApplication1/WebApplication1/wwwroot/favicon.ico'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 1.081ms 200 image/x-icon
mvcの実行2

OSバージョンの確認

以下のような感じ。

OperatingSystem os = Environment.OSVersion;
if (os.Platform == PlatformID.Win32NT)
{
    ・・・

リモートデバッグ

C/C++

WSLのリモートデバッグ設定

以下は、すべて、WSL(Ubuntu)上の設定。

Visual Studioの設定

以下は、すべて、Windows上の設定。

.NET Core

仕組みとしては、

<Windows>
Visual Studio → DebugAdapterHost? → PuTTY

↓ ↓ ↓(SSH)↑ ↑ ↑

<Linux>
openssh-server → vsdbg → dotnet (XXXX.dll)

みたいな感じで、

通信してdebugする感じ。

WSLのリモートデバッグ設定

Visual Studioの設定

FDDがイイのか?SCDがイイのか?

デバッグ実行を開始

※ ファイル名は「launch.json」でなくてもイイもよう。

ASP.NET Core

WSLのリモートデバッグ設定

Visual Studioの設定

以下を除き、.NET Coreと同じ。

デバッグ実行を開始

以下を除き、.NET Coreと同じ。

Visual Studioからデバッガをアタッチする方法

WSLのリモートデバッグ設定

以下を除き、ASP.NET Coreと同じ。

Visual Studioの設定

デバッグ実行を開始

参考

※ 1

DrvFsのVFSファイルシステムプラグイン。

トレースによるデバッグ

リモートデバッグが難しい場合はコチラ。

リモートデバッグ

C/C++

.NET Core

OSSコンソーシアム


Tags: :.NET開発, :.NET Core, :Windows, :Linux, :Linuxサブシステム, :仮想化


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS