Skip to content

WPF app using CsWin32 fails to publish - GenerateTemporaryTargetAssembly project is not importing nuget props #51474

@jevansaks

Description

@jevansaks

Describe the bug

Publishing a WPF app that uses cswin32 fails to publish from VS but succeeds using "dotnet publish" at the command line.

What I see comparing the successful dotnet publish vs VS publish is that VS publish runs the GenerateTemporaryTargetAssembly stuff a second time, and that second invocation fails during CSC.

I also notice that during that second invocation, AdditionalFiles itemgroup is empty (this is why cswin32 fails), implying that the nuget cswin32.props did not get imported. It looks none of the nuget imports are happening this second time around.

To Reproduce

Clone https://github.com/BennyBread/WpfCsWin32PublishApp
Open .sln in VS
Right click solution and "Publish..." and accept defaults

Result:
Publish fails during compile due to missing "Windows" namespace and related errors.

See microsoft/CsWin32#1188 for more details.

Exceptions (if any)

Further technical details

details of dotnet --info

- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions