Improve vscode dotnet support (#8384)

* Run make ensure on devcontainer creation

Added an ensure target to the dotnet makefile to run `dotnet restore`.

* Add dotnet test explorer and set default vscode settings for it

* Ensure PULUMI_LOCAL_NUGET exists

* Add missing mkdirs
This commit is contained in:
Fraser Waters 2021-11-11 20:40:18 +00:00 committed by GitHub
parent 0343a6de76
commit c6240cf38d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 6 deletions

View File

@ -16,10 +16,9 @@
"remoteUser": "user",
"extensions": ["golang.go", "ms-dotnettools.csharp", "ms-python.python"],
"extensions": ["golang.go", "ms-dotnettools.csharp", "ms-python.python", "formulahendry.dotnet-test-explorer"],
// We want to dotnet restore all projects on startup so that omnisharp doesn't complain about lots of missing types on startup.
"postCreateCommand": "find -name \"*.??proj\" | xargs -L1 dotnet restore",
"postCreateCommand": "make ensure",
"settings": {
"extensions.ignoreRecommendations": true

View File

@ -160,6 +160,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -229,6 +230,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -303,6 +305,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1

View File

@ -143,6 +143,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -206,6 +207,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -280,6 +282,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -295,9 +300,6 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Clean
run: dotnet nuget locals all --clear
- name: Create Local Nuget
run: mkdir -p "D:\\Pulumi\\nuget"
shell: bash
- name: Install Python Deps
run: |
pip3 install pyenv-win

View File

@ -236,6 +236,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -305,6 +306,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -386,6 +388,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1

View File

@ -82,6 +82,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -170,6 +171,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
@ -279,6 +281,9 @@ jobs:
run: |
pip3 install pyenv-win
pip3 install pipenv
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Set Build Env Vars
shell: bash

View File

@ -11,4 +11,7 @@
// Experimental but seems to work and means we don't need a vscode instance per go.mod file.
"experimentalWorkspaceModule": true,
},
"omnisharp.defaultLaunchSolution": "sdk/dotnet/dotnet.sln",
"dotnet-test-explorer.testProjectPath": "sdk/dotnet",
}

View File

@ -14,6 +14,10 @@ include ../../build/common.mk
# `test_all` without the dependencies.
TEST_ALL_DEPS = install
ensure::
# We want to dotnet restore all projects on startup so that omnisharp doesn't complain about lots of missing types on startup.
dotnet restore dotnet.sln
build::
# From the nuget docs:
#