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

SourceGenerator not working with version 0.1.506 #326

Closed
stiezinger opened this issue Jul 12, 2021 · 5 comments
Closed

SourceGenerator not working with version 0.1.506 #326

stiezinger opened this issue Jul 12, 2021 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@stiezinger
Copy link

stiezinger commented Jul 12, 2021

Hello,

I was using version 0.1.422 without issues, updated to 0.1.506 and the Source Generator will not work anymore.

I receive the error: The type or namespace name 'Windows' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?).

Rolling back to 0.1.422 fixes everything.

I am using Visual Studio Version 16.10.3 with Windows 10 Version 1909.

@jnm2
Copy link
Contributor

jnm2 commented Jul 12, 2021

The namespaces all changed. VS also has a bug where it will not give you light bulb fixes to add using directives for types declared by source generators, so it's temporarily a painstaking process to find and type in all the right using directives. The quickest way I know of to deal with this is to click on the type that can't be found, press Ctrl+T to open "Go To All" with that type name prefilled, press enter to navigate to the .g.cs file that should be the top entry found, then observe the namespace (and nested namespace) surrounding the type name.

Once you have a block of using statements, you can go file to file pasting in that block and then pressing Ctrl+R, Ctrl+G to remove and sort usings.

@anhhh11
Copy link

anhhh11 commented Jul 19, 2021

Use
using Windows.Win32;
instead of
using Microsoft.Windows.Sdk;

@malcolms
Copy link

This thoroughly confused me for about half an hour.

I note that the Readme.md still references the old namespaces though.

@jnm2
Copy link
Contributor

jnm2 commented Jul 30, 2021

Is anyone interested in contributing a readme fix to update Microsoft.Windows.Sdk to the new namespace?

@AArnott
Copy link
Member

AArnott commented Aug 18, 2021

Fixed in cc0ac97.

@AArnott AArnott closed this as completed Aug 18, 2021
@AArnott AArnott added the documentation Improvements or additions to documentation label Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants