22
votes

Follow this menu sequence:

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

Build -> Build Solution

Get this error:

Error C:\Users\Sam\Documents\Visual Studio 2015\Projects\RC2 Test\src\RC2 Test\error CS2001: Source file 'C:\Users\Sam\Documents\Visual Studio 2015\Projects\RC2 Test\src\RC2 Test\Test.deps.json' could not be found. RC2 Test C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241

Searching for test.deps finds nothing.

Is "test" a hardcoded name for a unit test project?
dotnet --version says 1.0.0.0-preview1-002702

Edit:

I repeated the above steps but this time I selected Core Web Application (.Net Core). I get the same error.

Looks like we cant use spaces in project names.

4

4 Answers

40
votes

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

3
votes

I've just created an empty file ex: MyProject.deps.json and now it's working fine.

I'm using VS2015 update 3

0
votes

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.

0
votes

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