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

Projection file disappears in WPF project #1543

Open
mmarczell-graphisoft opened this issue Mar 19, 2024 · 2 comments
Open

Projection file disappears in WPF project #1543

mmarczell-graphisoft opened this issue Mar 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mmarczell-graphisoft
Copy link

Describe the bug
I would like to use CsWinRT in WPF the same way I use it in a WinUI project, but it doesn't build.

To Reproduce
See my minimal repro at https://github.com/mmarczell-graphisoft/winrtbug

  1. Build and run the WinUI project. It builds and runs.
  2. Build the WPF project. It fails to build.

Expected behavior
The WPF project should also build and run.

Actual behavior
As long as I do not have the using directive in my WPF C# code, nor any code using those definitions, the C# projection file does get generated under obj\Debug\net6.0-windows\Generated Files\CsWinRT. However as soon as I enter the using directive and rebuild, this file is no longer there.

Version Info
CsWinRT 2.0.7
net6.0-windows

@mmarczell-graphisoft mmarczell-graphisoft added the bug Something isn't working label Mar 19, 2024
@mmarczell-graphisoft
Copy link
Author

@smourier has provided a workaround which can be seen here:
https://stackoverflow.com/questions/78316887/use-c-winrt-component-but-really-any-winrt-component-in-wpf-net-6/78342481#78342481

or here:
mmarczell-graphisoft/winrtbug@e417f57

but this is only a workaround, the bug still stands.

@mmarczell-graphisoft
Copy link
Author

Looking at cswinrt.rsp (which is a file that contains the command line arguments), I can observe that as long as my C# code does not contain using winrtcomponent_cpp;, the rsp file contains

-input "C:\Dev\git\winrtbug\_build\x64\Debug\winrtcomponent.cpp\bin\winrtcomponent.cpp\winrtcomponent_cpp.winmd"

but if I enter the using directive, that line in the rsp becomes empty.

- input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant