Q:

Github Action DotNetCore sln and project in same folder

name: .NET Core

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
jobs:
  build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
  uses: actions/setup-dotnet@v1
  with:
    dotnet-version: 3.1.101
- name: Install dependencies
  run: dotnet restore
- name: Build
  run: dotnet build --configuration Release --no-restore
- name: Test
  run: dotnet test --no-restore --verbosity normal

this my yml code .
it showing error MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
[error]Process completed with exit code 1.
in dotnet restore step because the sln in the project folder. how to solve this problem

A:

Just define path to the directory that has solution or project file. Assuming that project file location is src/MyProject/MyProject.csproj, then Install dependencies step should be:
- name: Install dependencies
  run: dotnet restore
  working-directory: src/MyProject

