dotnet / dotnet/msbuild

[Bug]: Dependencies not handled correctly when using Rebuild vs. Clean + Build (in VS and MSBuild)

Open
#10,533 4 comments 1 reaction 0 assignees View on GitHub
bug triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

`msbuild ILSpy.sln /t:Rebuild` fails while `msbuild ILSpy.sln /t:Clean;Build` succeeds.

### Steps to Reproduce

For the needed workloads/SDKs see for more info: https://github.com/icsharpcode/ILSpy#how-to-build

1) `git clone https://github.com/icsharpcode/ILSpy.git`
2) `msbuild /t:Restore ILSpy.sln`
3) `msbuild /t:Build ILSpy.sln`
4) `msbuild /t:Rebuild ILSpy.sln` fails, while `msbuild /t:Clean;Build ILSpy.sln` succeeds

[binlogs.zip](https://github.com/user-attachments/files/16645151/binlogs.zip)

### Expected Behavior

Rebuild succeeds iff Clean and Build succeed.

### Actual Behavior

```
Build FAILED.

"ILSpy\ILspy.sln" (Rebuild target) (1) ->
"ILSpy\ILSpy.BamlDecompiler.Tests\ILSpy.BamlDecompiler.Tests.csproj" (Rebuild target) (10)
->
(_CopyOutOfDateSourceItemsToOutputDirectory target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5270,5): error MSB3030: Could not copy the file "ILSpy\ILSpy\bin\Debug\net8.0-windows\ILSpy.deps.json" because it was not found. [ILSpy\ILSpy.BamlDecompiler.Tests\ILSpy.BamlDecompiler.Tests.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5270,5): error MSB3030: Could not copy the file "ILSpy\ILSpy\bin\Debug\net8.0-windows\ILSpy.runtimeconfig.json" because it was not found. [ILSpy\ILSpy.BamlDecompiler.Tests\ILSpy
.BamlDecompiler.Tests.csproj]

"ILSpy\ILspy.sln" (Rebuild target) (1) ->
"ILSpy\ILSpy.Tests\ILSpy.Tests.csproj" (Rebuild target) (12) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5270,5): error MSB3030: Could not copy the file "ILSpy\ILSpy\bin\Debug\net8.0-windows\ILSpy.deps.json" because it was not found. [ILSpy\ILSpy.Tests\ILSpy.Tests.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5270,5): error MSB3030: Could not copy the file "ILSpy\ILSpy\bin\Debug\net8.0-windows\ILSpy.runtimeconfig.json" because it was not found. [ILSpy\ILSpy.Tests\ILSpy.Tests.csproj]

0 Warning(s)
4 Error(s)
```

### Analysis

_No response_

### Versions & Configurations

❯ msbuild --version
MSBuild version 17.10.4+10fbfbf2e for .NET Framework
17.10.4.21802

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.