With a .NET 7 project we can convert existing DllImport into LibraryImport, see screenshot below. This is a great feature. Unfortunately it does not convert structs into custom marshaller structs. As @AaronRobinsonMSFT mentioned those would provide the most ideal performance instead of using Marshal.PtrToStructure but also fixing errors we get after the conversion when a struct is used as parameter. Not everyone knows about custom marshaller structs or that they perform better. And not everyone knows how to rewrite their structs. It would be superior, just as with LibraryImport, if Visual Studio can do this for us. I was getting told to file out an issue here to requesting it. Background: #45100
Screenshots

