-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 fails after updating to .NET 5 RC 1 with Method 'Initialize' missing #47699
Comments
Try changing the Initialize method argument to |
error CS0246: The type or namespace name 'GeneratorInitializationContext' could not be found (are you missing a using directive or an assembly reference?) ISourceGenerator requires the old names, unless I also need to update my nuget references:
|
see #47681 add the following key to your NuGet.config: |
I don't have a package reference to Microsoft.CodeAnalysis.CSharp at all, or do you mean Microsoft.CodeAnalysis.CSharp.Workspaces? |
I updated my NuGet.config found in ~/.config/NuGet And added a PackageReference
But that just resulted in this error /home/daniel/Work/JsonSrcGen/JsonSrcGen.Generator/JsonSrcGen.Generator.csproj : error NU1102: Unable to find package Microsoft.CodeAnalysis.CSharp with version (>= 3.8.0-4.20464.1) [/home/daniel/Work/JsonSrcGen/UnitTests/UnitTests.csproj] |
You must add the package source for the dotnet-tools preview packages. |
Both will work, Microsoft.CodeAnalysis.CSharp.Workspaces depends on Microsoft.CodeAnalysis.CSharp. Means updating Microsoft.CodeAnalysis.CSharp.Workspaces should do the trick as well. |
OK I have it working, My generator .csproj has the following line:
Which had to be changed to:
Note the difference is dotnett5 -> dotnet-tools Here is my working project for for anyone else who runs into this:
See this commit for the full fix: I do have a question though, will this PackageSource be required in the .NET 5 full release or is just a work around to a temporary problem? |
@chsienki Do we have public packages now with the changed APIs that people can reference? |
We're just waiting on the 16.8p3 packages to be released. We're in a slightly odd situation where a few things are out of sync :/ |
Version 3.8.0-3.final is now available on the public feeds https://www.nuget.org/packages/Microsoft.CodeAnalysis/3.8.0-3.final |
Closing this, as it should be resolved with the public packages. Please let us know if you're not seeing the expected resolution. |
The public packages have some warnings
Seems they are relying on unreleased nuget packages. Can open an issue if it makes sense to do so. |
@333fred The issue above is fixed by your further upgrading of packages, I'd hope? |
Yes, that will be fixed in RC2/16.8p4. The change didn't quite make RC1/16.8p3 |
Version Used:
5.0.100-rc.1.20452.10
Steps to Reproduce:
Expected Behavior:
Generates source code for json
Actual Behavior:
The Method 'Initialize' exists, and it hasn't changed since the code was working with the Previews.
The text was updated successfully, but these errors were encountered: