Repository navigation
How to use CsWinRT in a Visual Basic Project project #2122
|
Based on this C# console sample, I would like to create a console, a WinForms, and a WPF sample in Visual Basic. Build tells me that there are Visual-Basic-Syntax-Errors in the .cs file. (BC30035) My current workaround is to add a C# console project to the solution, install the required packages 'CsWinRT' and 'midi2' there, and build the C# project. The corresponding code can be found here Is my workaround the right way, or can it be done better? |
Replies: 3 comments 5 replies
|
You can't use CsWinRT directly in Visual Basic because it generates C# code. What you need to do is to create a C# project, add CsWinRT in there and add a project reference to the Visual Basic project. |
|
Based on your error and looking at your project, I feel like you are just trying to consume a generated cswinrt projection and not trying to generate one yourself, right? If so, you can try removing the cswinrt package reference from your project and it should still build as the cswinrt dependencies should come from the target framework. |
|
Thanks all for helping with this. I am the owner of the |

You can't use CsWinRT directly in Visual Basic because it generates C# code. What you need to do is to create a C# project, add CsWinRT in there and add a project reference to the Visual Basic project.