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

Error "The type 'NSObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.iOS, Version=0.0.0.0" #20570

Closed
PureWeen opened this issue May 7, 2024 · 5 comments
Labels
need-attention An issue requires our attention/response
Milestone

Comments

@PureWeen
Copy link

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22021


From @navkumar401 on Wednesday, April 24, 2024 4:26:12 AM

0

In my iOS MAUI project, I'm getting an error "The type 'NSObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'" for references that are referring to a Binding Project that has been upgraded to Microsoft.iOS framework.

I can see that the Binding Project is referencing Microsoft.iOS in the decoded DLL but still, the iOS project is throwing the above error for Xamarin.iOS.

I couldn't find much help online and being stuck with this for a long time, any help would be great.

@PureWeen
Copy link
Author

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22021


From @drasticactions on Thursday, April 25, 2024 5:40:24 AM

CC @rolfbjarne

Can you make a repro project for how you're setting up your binding projects? my guess is that you're directly referencing the binding project to your app, which I believe won't work. You would either need to package your library into a nuget, or reference the outputted DLL from the project, not the project itself.

@PureWeen
Copy link
Author

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22021


From @navkumar401 on Thursday, April 25, 2024 10:19:24 AM

I am referencing the binding project as a DLL only. As you said, it will not work as a project reference.

Another weird thing is that the IntelliSense is not working properly on the binding project. I cannot see what package of iOS (Xamarin.iOS or Microsoft.iOS) the "Foundation" namespace refers to. But since the binding project is referencing Microsoft.iOS physically, I can see the same in the output DLL.

I have uploaded a piece of code from the binding project here

I could not get the sample iOS project (I will continue to try) but we're getting the error in question if we use any type (from the binding project dll. ex: UPCA) in the iOS project.

@rolfbjarne
Copy link
Member

I am referencing the binding project as a DLL only. As you said, it will not work as a project reference.

Is the main project a .NET project or a Xamarin project?

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label May 7, 2024
@rolfbjarne rolfbjarne added this to the Future milestone May 7, 2024
@rmorin04
Copy link

Any updates?

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels May 14, 2024
@navkumar401
Copy link

navkumar401 commented May 17, 2024

It's a .Net project.

Anyway, I had to create a new project again and copy over the files. It worked there. This thread can be closed. Thanks to all who responded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-attention An issue requires our attention/response
Projects
None yet
Development

No branches or pull requests

4 participants