MSBuildProjectExtensionsPath not handled correctly in GenerateTemporaryTargetAssembly
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
This is a duplicate/regression of #5679, which I cannot reopen.
Using MSBuildProjectExtensionsPath in a dotnet-wpf application results in an error, because the build process tries to access a directory that does not exist and is not the one given in MSBuildProjectExtensionsPath.
### Reproduction Steps
Create `Directory.Build.props`.
```
$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\
$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\
$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\$(Configuration)\
```
then execute `dotnet new wpf -n MyApp ; dotnet new sln ; dotnet sln add MyApp ; dotnet build`
### Expected behavior
Successful build.
### Actual behavior
`C:\Program Files\dotnet\sdk\8.0.303\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1004: Assets file 'D:\dev\sdktest\obj\MyApp_32u0chsa_wpftmp\project.assets.json' not found. Run a NuGet package restore to generate this file. [D:\dev\sdktest\MyApp\MyApp_32u0chsa_wpftmp.csproj]`
### Regression?
This seems to be a regression. The original issue #5679 was reported for .NET Core Version: 6.0.100, and was reported as fixed in 7.0.100-preview.4.22252.9. However, I am experiencing this issue with 8.0.303.
### Known Workarounds
Everything works as long as MSBuildProjectExtensionsPath is not set. This issue only appears if MSBuildProjectExtensionPath is set.
### Impact
The bug impacts any project that uses wpf and sets MSBuildProjectExtensionsPath on `.net8.0-windows`
### Configuration
```
dotnet --info
.NET SDK:
Version: 8.0.303
Commit: 29ab8e3268
Workload version: 8.0.300-manifests.34944930
MSBuild version: 17.10.4+10fbfbf2e
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.303\
```
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.