Skip to content

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

@ghost

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions