.deps.json could not be found

前端 未结 4 2075
别跟我提以往
别跟我提以往 2021-02-12 14:14

Follow this menu sequence:

File -> New -> Project -> ASP>NET Core Web Application (.Net Framework)

Build -> Build Solution

Get this error:

Error

4条回答
  •  长发绾君心
    2021-02-12 14:38

    In my case, the problem was that I tried to run unit tests using a dll from the ref folder.

    As described by Pavol Kovalik in https://developercommunity.visualstudio.com/solutions/1270375/view.html:

    Mine was caused by having 2 Project.Tests.dll files in build artifact directory

    ...\Debug
      net5.0
        ref
          Project.Tests.dll
        Project.Tests.dll
        Project.Tests.deps.json 
    

    As such the vstest was discovering 2 test files. First without deps.json file and another with it. My fix was to enforce that test file is in net* directory (could be net5.0 or net48 in my case) like this

    - script: |
        dotnet vstest $(Build.BinariesDirectory)/bin/**/net*/*.Tests.dll --logger:trx
      displayName: Execute unit tests
    

提交回复
热议问题