Follow this menu sequence:
File -> New -> Project -> ASP>NET Core Web Application (.Net Framework)
Build -> Build Solution
Get this error:
Error
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
I have the same issue, but I created a project with name "MyprojectWithoutSpaces" and the issue is gone. I suppose is a problem in the RC version
Most likely you have an underscore in your project's name or its parent directory/directories. Remove that underscore if you find, and rebuild the project.
I've just created an empty file ex: MyProject.deps.json
and now it's working fine.
I'm using VS2015
update 3