dotnet / dotnet/msbuild

MSBuild with target netfx48 temp files present fails with Missing Method.

Open
#7,873 13 comments 7 reactions 0 assignees View on GitHub
Area: Documentation Breaking Change bug triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description
Using a roslyn CodeAnalysis project running on net48 attempting to load a project also targetting net48 will fail to load dependencies caused by a missing method ``Method not found: 'System.ReadOnlySpan`1 Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1)'`` if the target project has already been compiled and has bin/obj directories present.

### Steps to Reproduce
[CodeAnalysisApp2.zip](https://github.com/dotnet/msbuild/files/9304337/CodeAnalysisApp2.zip)
Repro is attached. To use
1) unzip and open the `CodeAnalysisApp2.sln` file then run it. It should load the console app solution and correctly run through to the console readline without displaying any problems.
2) open the `ConsoleApp2.sln` and compile or run it
3) reopen the `CodeAnalysisApp2.sln` and run it again, you should get an error:
```
Using MSBuild at 'C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin' to load projects.
Loading solution '..\..\..\..\ConsoleApp2.sln'
Evaluate 0:00.2464048 ConsoleApp2.csproj
Msbuild failed when processing the file 'D:\Programming\csharp10\CodeAnalysisApp2\ConsoleApp2\ConsoleApp2.csproj' with message: Method not found: 'System.ReadOnlySpan`1 Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1)'.
Finished loading solution '..\..\..\..\ConsoleApp2.sln'
```

### Versions & Configurations
Latest VS 17.3 update, this worked on 17.2.
MSBuild version 17.3.0+f67e3d35e for .NET Framework 17.3.0.37102

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.