-
Notifications
You must be signed in to change notification settings - Fork 84
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
Source Generator not installed for packages.config projects #62
Comments
Update:
This gave me the incorrect perception that Visual Studio shipped with a component that CsWin32 relied upon and would enable me to use this with .NET Framework projects. I'm bummed out now, we can't use any of this stuff. |
@riverar, this project does indeed support projects targeting .NET Framework. You only need to use the C# 9 version of the compiler. That compiler ships both with VS 2019.8 and the .NET 5 SDK. But targeting .NET 5 is not necessary. Following your repro steps, I hit the same symptom you did. But only when my IDE/project was configured to use packages.config. If I removed the packages from the project and changed my IDE to prefer PackageReference, then reinstalled the "Microsoft.Windows.CsWin32" package, it worked. So, I'm going to reactivate and retitle your issue to track that this doesn't work with packages.config and will investigate whether we can fix that. I also filed microsoft/win32metadata#180 to track another minor issue I saw with packages.config that must be fixed in the metadata. Thank you for your report. In the meantime, can you switch from packages.config to PackageReference? It's a much better world anyway 😉. |
@AArnott Thanks Andrew. Definitely confused here because according to Microsoft elsewhere, C# 9 requires .NET 5.
|
You're making the understandable mistake of confusing compiler versions with language versions. Using the C# 9 language version is only officially supported on the .NET 5 runtime, it is true. However this source generator only requires the C# 9 version of the compiler. Your project can still set C# 7.3 or 8 as its That said, the source generator may generate syntax that only the C# 9 language version will parse. For example, we do generate function pointers at times, and that requires the C# 9 language version. But you may not even need to generate any function pointers, and you'd be fine with a lesser language version. |
The README states:
Note no mention of language or compiler. And if it was amended to say Don't get me wrong, am happy to be wrong in this case. But perhaps a takeaway here is that a WinDev MVP was confused, so this may not be the best onboarding experience. 😆 |
He doesn't. C# 9 is the name and version of a language, not a compatible compiler. |
@Micke3rd Fair enough. I'll revise my wording going forward and update the published docs on this repo to be more clear. |
Repro steps:
.NET Framework 4.8
, then click the Create buttonMicrosoft.Windows.CsWin32
nuget prerelease packageNativeMethods.txt
file, with single line containingCreateFileW
The text was updated successfully, but these errors were encountered: