-
Notifications
You must be signed in to change notification settings - Fork 249
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
dotnet build continues when restore fails #6061
Comments
From @forki on October 19, 2017 15:52 This is really important for Paket since we try to let the build fail from targets file when certain conditions are not met. But instead it just continues. ¯_(ツ)_/¯ |
@forki Is this just a regular restore or are you doing some form of customization? I just tried it out on a project by updating a package reference to a non-existing version and I see that the restore failure is actually stopping the build. Also, we have this piece of code in place: https://github.com/dotnet/cli/blob/master/src/dotnet/commands/RestoringCommand.cs#L52 So, if restore fails, it should stop the next command from running. |
From @forki on October 19, 2017 16:37 @livarcocc did you follow the repro steps? This is calling dotnet build on a project that has targets. And the targets have an error task to explicitly stop the build |
From @forki on October 19, 2017 16:41 But it does not. The error is only shown on command line and then build continuous |
From @forki on October 19, 2017 16:46 So in other words: it's not the nuget task that fails, but targets along the way in "dotnet restore". |
This may be a regression in 2.0.2:
Trying that locally with 2.0.2 now. |
Yes, this is a regression in NuGet. So, in 2.0.2 we took in a new version of NuGet. It seems like their targets have changed and now your targets are not causing the restore operation to fail anymore. I am going to move this issue over to NuGet/Home to have the NuGet team take a look at it. |
According to @livarcocc on twitter: this stops the build as expected if we use dotnet 2.0.0. |
@emgarten can you take a look at this on priority if this is indeed a regression, then we might want to consider this for 15.5. |
Removing In 2.0.2 NuGet started calling The solution to this is for NuGet to use the skip non-existent targets feature which recently went into MSBuild, and then we'll be able to remove ContinueOnError, and fail appropriately when a project has an actual error. This wasn't available for 2.0.2. MSBuild feature issue: dotnet/msbuild#2471 |
@emgarten Since the msbuild issue is closed, can we get this in? |
@mishra14 we need to use the msbuild feature in our targets. Let's track that work there. |
Add support for skipping non-existent targets this sprint. |
* Add BuildInParallel to MSBuild tasks * Add SkipNonexistentTarget support * Reduce TargetFramework iteration Fixes NuGet/Home#6310 Fixes NuGet/Home#6311 Fixes NuGet/Home#6312 Fixes NuGet/Home#6061
From @forki on October 19, 2017 15:43
Steps to reproduce
Expected behavior
process stops after restore error (which we set from MyTargets,targets)
Actual behavior
the build continues after restore. And if you still have the assets file for weird reasons then build even succeeds.
Environment data
dotnet --info
output: 2.0.2Copied from original issue: dotnet/cli#7870
The text was updated successfully, but these errors were encountered: