actions / setup-dotnet

Set up your GitHub Actions workflow with a specific version of the .NET core sdk
MIT License
922 stars 454 forks source link

Github action: error MSB1009: Project file does not exist. #355

Closed varndellwagglebee closed 1 year ago

varndellwagglebee commented 1 year ago

Description: MSBuild version 17.4.0+18d5aef85 for .NET MSBUILD : error MSB1009: Project file does not exist. Switch: ./hyperbee.sln Error: Process completed with exit code 1.

Task version: GitHub actions

Platform:

Runner type:

Repro steps:
Project structure:

.github/workflows src/hyperbee src/hyperbee.messaging.PubNub src/Hyperbee.api.core src/hyperbee.data.abstractions src/hyperbee.data.couchbase src/hyperbee.migrations.Couchbase tests hyperbee.sln

WorkFlow: name: Build and Unit Test

on: workflow_dispatch:

env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} LPOINT: ${{ secrets.NUGET_SOURCE_LPOINT}} USE_PACKAGE_PRERELEASE: 'false' ALLOW_PRODUCTION_PUSH: 'false'

jobs: build-test: runs-on: ubuntu-latest

steps:
- name: Master Configuration
  if: ${{env.BRANCH_NAME =='master' }}
  run: |
      echo "BUILD_CONFIGURATION=Release" >> $GITHUB_ENV
      echo "VERSION_SUFFIX=" >> $GITHUB_ENV 

- name: Debug Configuration
  if: ${{ env.BRANCH_NAME == 'develop'}}
  run: |
      echo "BUILD_CONFIGURATION=Debug" >> $GITHUB_ENV
      echo "VERSION_SUFFIX=develop.$(date +'%y%m%d%H%M%S')" >> $GITHUB_ENV

- name: Get code
  uses: actions/checkout@v3

- name: Setup .NET
  uses: actions/setup-dotnet@v3.0.3
  id: cp310
  with:
    dotnet-version: 7.0.*

- uses: actions/cache@v3
  with:
    path: ~/.nuget/packages
    # Look to see if there is a cache hit for the corresponding requirements file
    key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
    restore-keys: |
      ${{ runner.os }}-nuget

- name: Build Solution
  run: |
    echo '${{ steps.cp310.outputs.dotnet-version }}'
    dotnet build ./hyperbee.sln --configuration ${{env.BUILD_CONFIGURATION}} -p:CI=true -p:UsePackagePreRelease=${{env.USE_PACKAGE_PRERELEASE}} -p:SourceBuildNumber=${{github.run_number}} -p:SourceRevisionId=${{ github.sha }}

- name: Install Unit Test tool
  run: |
    echo 'REPORTS_PATH=./test-reports/build_${{github.run_number}}' >> $GITHUB_ENV
    dotnet tool install -g trx2junit

- name: Run Unit Tests
  run: dotnet test --no-build --configuration ${{env.BUILD_CONFIGURATION}} --logger:trx --results-directory:./TestResults

- name: Unit Test Post-processing
  run: |
    echo 'export PATH="$PATH:/root/.dotnet/tools"' >> "$GITHUB_ENV"
    trx2junit ./TestResults/*.trx

Expected behavior: To be able to build the solution file

Actual behavior: MSBuild version 17.4.0+18d5aef85 for .NET MSBUILD : error MSB1009: Project file does not exist. Switch: ./hyperbee.sln Error: Process completed with exit code 1.

IvanZosimov commented 1 year ago

Hi, @varndellwagglebee 👋 Thank you for your issue, but unfortunately, this problem seems unrelated to our action, as the Error states there is a lack of .csproj file in your project, and it is the root cause of your issue. Probably while committing you unintentionally deleted it.

Now I'm going to close this issue, If you have any additional questions feel free to ping me.

varndellwagglebee commented 1 year ago

The project file is there. But not seeing it.

IvanZosimov commented 1 year ago

@varndellwagglebee, could you provide me with a public repo to be able to reproduce your error?

varndellwagglebee commented 1 year ago

https://github.com/Stillpoint-Software/hyperbee

IvanZosimov commented 1 year ago

@varndellwagglebee, sorry, but I don't have access to this repository.

varndellwagglebee commented 1 year ago

I invited you to repository.

IvanZosimov commented 1 year ago

Hi, @varndellwagglebee 👋 I investigated your repository and found that you made a mistake in the build command: 1) you should consider changing name of the solution in the build command from hyperbee.sln to Hyperbee.sln After that change dotnet build will start work normally.

This is not the issue of the action, just a typo in your code.

varndellwagglebee commented 1 year ago

Thank you for all your help.

JoshuaCarroll commented 1 year ago

Thank you for all your help.

Sorry to do this here, but may I please look at your repo too? I'm having a similar problem with my CI/CD action and was hoping I could look at one that is working.