Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSBuildProjectExtensionsPath not handled correctly in GenerateTemporaryTargetAssembly #5679

Closed
zivkan opened this issue Nov 10, 2021 · 2 comments
Assignees
Labels
Investigate Requires further investigation by the WPF team.

Comments

@zivkan
Copy link
Member

zivkan commented Nov 10, 2021

  • .NET Core Version: 6.0.100
  • Windows version: n/a
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No

Problem description: A customer reported this issue to NuGet: NuGet/Home#4463 (comment)

I'm reporting it here, but @mkonijnenburg is the affected customer

Actual behavior:

C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1004: Assets file 'C:\src\test\wpfArtifacts\obj\MyApp_3j03kfnj_wpftmp\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\src\test\wpfArtifacts\src\MyApp\MyApp_3j03kfnj_wpftmp.csproj]

Expected behavior:

Build successfully

Minimal repro:

Create Directory.Build.props:

<Project>
    <PropertyGroup>
        <BaseOutputPath>$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\</BaseOutputPath>
        <MSBuildProjectExtensionsPath>$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\</MSBuildProjectExtensionsPath>
        <IntermediateOutputPath>$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\$(Configuration)\</IntermediateOutputPath>
    </PropertyGroup>
</Project>

then dotnet new wpf -n MyApp ; dotnet new sln ; dotnet sln add MyApp ; dotnet build

If I use global.json to pin the .NET SDK to 5.0.x, then this problem does not reproduce.

@mkonijnenburg
Copy link

mkonijnenburg commented Nov 17, 2021

A quick non-generic workaround

<Project> <Choose> <When Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectName), '^ProjectA.*_[0-9a-z]{8}_wpftmp$'))"> <PropertyGroup> <BaseOutputPath>bin\ProjectA\</BaseOutputPath> <MSBuildProjectExtensionsPath>obj\ProjectA\</MSBuildProjectExtensionsPath> <IntermediateOutputPath>obj\ProjectA\$(Configuration)\</IntermediateOutputPath> </PropertyGroup> </When> <When Condition="! $([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectName), '^.*_[0-9a-z]{8}_wpftmp$'))"> <PropertyGroup> <BaseOutputPath>bin\$(MSBuildProjectName)\</BaseOutputPath> <MSBuildProjectExtensionsPath>obj\$(MSBuildProjectName)\</MSBuildProjectExtensionsPath> <IntermediateOutputPath>obj\$(MSBuildProjectName)\$(Configuration)\</IntermediateOutputPath> </PropertyGroup> </When> </Choose> </Project>

@singhashish-wpf singhashish-wpf self-assigned this Nov 29, 2021
@singhashish-wpf singhashish-wpf added Investigate Requires further investigation by the WPF team. and removed Untriaged Requires WPF team triage labels Nov 29, 2021
@pchaurasia14
Copy link
Member

With the steps to reproduce mentioned above, it looks like things are working fine with the new SDK releases.

Please let us know if that is not the case.

image

@ghost ghost locked as resolved and limited conversation to collaborators Jul 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Investigate Requires further investigation by the WPF team.
Projects
None yet
Development

No branches or pull requests

4 participants