Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet restore improperly NoOps when 2 projects are sharing obj directory #6114

Closed
BrennanConroy opened this issue Oct 27, 2017 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@BrennanConroy
Copy link

@emgarten

  1. dotnet new console
  2. dotnet run (just to make sure it runs)
  3. change name of csproj and downgrade the netcoreapp version to 1.0 or 1.1
  4. dotnet restore
  5. dotnet run (make sure it runs too)
  6. rename csproj to original name
  7. undo the previous downgrade
  8. dotnet restore (does nothing)
  9. dotnet run
  10. See error:
C:\Program Files\dotnet\sdk\15.5.0-preview-007044\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(167,5):
error : Assets file 'C:\app\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.0'.
Ensure that restore has run and that you have included 'netcoreapp2.0' in the TargetFrameworks for your project. [C:\app\app.csproj]

The build failed. Please fix the build errors and run again.
@mishra14
Copy link
Contributor

mishra14 commented Oct 27, 2017

@BrennanConroy Thanks for reporting this issue. I think this is an issue with some no-op check that we have to prevent restore if no files have changed. Requesting @nkolev92 to investigate.

in the mean time please use dotnet restore --force to ensure that a new restore is done if you run into such an issue.

@mishra14 mishra14 added Area:RestoreNoOp The PackageReference no-op Type:Bug and removed Triage:Investigate labels Oct 27, 2017
@mishra14 mishra14 added this to the Backlog milestone Oct 27, 2017
@mishra14 mishra14 added the Priority:2 Issues for the current backlog. label Oct 27, 2017
@mishra14 mishra14 assigned nkolev92 and unassigned nkolev92 Oct 27, 2017
@nkolev92
Copy link
Member

nkolev92 commented Oct 28, 2017

@BrennanConroy

This scenario is equivalent to having ProjectA (NetCore20) and ProjectB (NetCore10) in the same directory.

They both create the same assets file (project.assets.json), while they each create a separate cache file that's used for no-op.

This is not exactly a supported scenario, not sure if we want to do something about it.

The workaround as @mishra14 mentioned is very simple, you can do a restore force the time.

But the reality is that you have leftover build files in the obj folder that should not be there.

cc @emgarten

@nkolev92 nkolev92 self-assigned this Oct 28, 2017
@rrelyea
Copy link
Contributor

rrelyea commented Oct 30, 2017

Although the title says edge case, no-op is important enough to make this issue a p1 backlog issue.

@emgarten
Copy link
Member

emgarten commented Nov 9, 2017

Related: #4463

@rrelyea rrelyea modified the milestones: Backlog, 5.0 Aug 14, 2018
@rrelyea rrelyea changed the title Edge case: NuGet restore doesn't overwrite project.assets.json NuGet restore improperly NoOps when 2 projects are sharing obj directory Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants