dotnet / dotnet/sdk

dotnet build fails with --no-restore and --artifacts-path

Open
#41,530 5 comments 0 reactions 0 assignees View on GitHub
Area-CLI Area-NetSDK
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
```dotnet build``` fails when specifying the ```--no-restore``` and ```--artifacts-path``` options together.

The restore is done separately in order to use lock files, since ```dotnet build``` doesn't support ```--locked-mode``` like ```dotnet restore``` does.

### To Reproduce
See this project for complete reproduction steps:

https://github.com/paulmedynski-microsoft/dotnet-build-issues

### Exceptions (if any)
```
$ dotnet build -c Release --no-restore --artifacts-path artifacts
/usr/share/dotnet/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1004: Assets file '/home/paul/dev/paulmedynski/dotnet-build-issues/artifacts/obj/dotnet-build-issues/project.assets.json' not found. Run a NuGet package restore to generate this file. [/home/paul/dev/paulmedynski/dotnet-build-issues/dotnet-build-issues.csproj]

Build FAILED.
```

### Further technical details

.NET SDK:
Version: 8.0.300
Commit: 326f6e68b2
Workload version: 8.0.300-manifests.c1c70047
MSBuild version: 17.10.4+10fbfbf2e

Runtime Environment:
OS Name: debian
OS Version: 12
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.300/

.NET workloads installed:
There are no installed workloads to display.

Host:
Version: 8.0.5
Architecture: x64
Commit: 087e15321b

.NET SDKs installed:
8.0.300 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.