sdk: [dotnet build] Can't replace MVC packages with sources

Steps to reproduce

Part of this verification task: aspnet/Release#10

Steps:

  1. Create web app project
  2. Clone https://github.com/aspnet/Mvc
  3. Add path to Mvc\src to global.json
  4. Restore (right-click project in Solution Explorer and click “Restore packages”) so VS sees new source refs (related: dotnet/sdk#4596)
  5. Build

Expected: my app should compile fine and I should be able to run it.

Actual: Severity Code Description Project File Line Suppression State Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.ViewFeatures\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.ViewFeatures.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.TagHelpers\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.TagHelpers.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.Razor.Host\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.Razor.Host.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.Razor\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.Razor.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.Localization\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.Localization.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.Formatters.Json\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.Formatters.Json.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.DataAnnotations\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.DataAnnotations.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.Cors\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.Cors.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.Core\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.Core.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.ApiExplorer\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.ApiExplorer.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc.Abstractions\bin\Debug\netstandard1.3\Microsoft.AspNetCore.Mvc.Abstractions.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Error c:\users\cesars\documents\visual studio 2015\Projects\VerifyReplacePackagesWithSources\src\VerifyReplacePackagesWithSources\error CS0006: Metadata file ‘D:\src\aspnet\Mvc\src\Microsoft.AspNetCore.Mvc\bin\Debug\netstandard1.5\Microsoft.AspNetCore.Mvc.dll’ could not be found VerifyReplacePackagesWithSources C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241

Expected behavior

Find binaries in correct place.

Actual behavior

It’s looking for MVC binaries in the wrong places.

Environment data

dotnet --info output:

C:\Windows\system32>dotnet --info .NET Command Line Tools (1.0.0-rc2-002678)

Product Information: Version: 1.0.0-rc2-002678 Commit Sha: 3b2ea9d14b

Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 5
  • Comments: 21 (10 by maintainers)

Most upvoted comments

I am a bit surprised why that matters and why you don’t “just try to do it”… I tried this repro steps as they were assigned to a bug for my team and was able to repro it within 5 mins, but extra questions in this issue postponed investigation for 1 extra day already. I am not trying to be a “smart ass”, but really it is just a pattern I noticed for some cli issues… Below is my global.json and as you would see that you could just do same thing without me yesterday, there not many choices how to specify folder and it does not matter for actual problem in this issue …

Here is my global.json:

{ “projects”: [ “src”, “test”, “D:\git\ms\aspnet\Mvc\src” ] }

I’m having this same problem now. I used to do this app the time with my rc1 aspnet app. Getting same errors as @abpiskunov now with RC2.

Anyone have a workaround?

@SeeWhat suggestion didn’t work. The issue is the output paths which (for Identity) say

<OutputPath Condition="'$(OutputPath)'=='' ">…\artifacts\bin</OutputPath>

but my projects are

<OutputPath Condition="'$(OutputPath)'=='' ">.\bin</OutputPath>

Changing the Identity XProj’s to match my projects and rebuilding fixes the issue.

For all who have it, I had this issue trying to debug MVC as part of my app. I resolved it by running dotnet build -c Debug in the src/Microsoft.AspNetCore.Mvc folder. This causes a build, after that I was able to successfully build my own project.

My guess is that Visual Studio doesn’t recognize the “added projects” via global.json as candidates for a project build.

@kspearrin Hi, Not your project files, but the project you want to debug against. So if you wanted to work debug/work with Microsoft.AspNetCore.Mvc.Abstractions then you’d modify it’s .xproj file.

Not ideal, but a workaround.

Apparently, this has to be done for all cascading dependencies.

For example, when trying to step into Microsoft.AspNetCore.Diagnostics, the OutputPath inside Microsoft.AspNetCore.Diagnostics.Abstractions.xproj had to be changed as well.

@DarrenV79 gave the right solution for me

Changing <OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\</OutputPath> to <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>

fixes it for me.

In my case, I was working with Identity.