I'm new to XNA and C#. I have this problem:
When I add a new windows game library and I make reference in main project everything seems ok. The problem is when I delete class from this new project. I'm losing the reference for this new library and I don't know why.
Is there solution for this?
have you used the correct using statement,
have you added a reference to the other project correctly
does the class exist in the other project
Related
I have a Xamarin.Forms project and a C# console app project. I want to use one class from the console app in my Xamarin.Forms project.
I added the console app project to the solutions explorer of the Xamarin.Forms project.
Unfortunately, I can't figure out how to use the class from the console app in one of the Xamarin files.
I always get the error message:
The name 'MyClass' does not exist in the current context.
I tried to press alt+enter to show potential fixes but it does not offer me the option of importing/using the class.
I also wrote manual using directives in various forms but it still does not seem to make the class accessible.
The only way I was able to use the class was by adding the class directly to the Xamarin project by adding it with add->existing item. The problem with this is that it imports a copy of the class. Since I'm still working on the class within the other project the added class is fast outdated and I have to manually copy its contents over.
How can I use a class from an external project without making a copy of the file?
Instead of access class from console app(its exe) try creating new reusable library add that class and use in both projects also you can write wrapper class in both projects
Try to add a reference to the second project in your first project. To do this, right-click on your project, select Add Reference then select the project in your solution. Once your main project references the second project, then you can access its public types.
I added a new class to my Class Library Domain called SongPlayDaily.cs but for some reason it does not display in my reference object browser. See image and correlated numbers:
Observe that the new class exists in my Domain class library
See that I reference this Class Library in my Unearth project.
Upon double clicking the Domain in the references dropdown below Unearth the object browser opens and you can see that SongPlayDaily is not referenced here
This is the console error I experience.
Right clicking on the SongPlayDaily.cs in the Class Library I can confirm that the Build Action: Compile
What other things can I check to see why this new class may not be showing up?
Thanks!
So dumb, I switched my Domain Class Library framework from 4.6.1 to 4.0 back to 4.6.1, rebuilt my solution and it is now referenced....
Every time I create a new solution in vs2017, I get errors on the using Xamarin.Forms directive and also on the app.axml.cs class definition when Application is inherited (which causes errors on the On methods), see image.
Is there a way of modifying the way vs configures solutions upon creation.
![Xamarin Errors](https://drive.google.com/drive/my-drive/xamarin errors.jpg)
I did a repair on the IDE, and everything is working now. I wish this version of studio was more stable. All I did was create a new cross platform solution and the errors were present. I could open a solution I had already worked on and it works fine. Go figure!
I have 2 C# projects first one name is "Advocar" and the second one is "Import".
There is a class in Advocar project which we need to access to that from Import project. So in Import project I added reference to Advocar.
The problem is from Import project I recognizes all the Advocar classes except the new class that I just created in the Advocar. and when I build it, it say "The Type or namespace does not exist in the Advocar.Data.Inventory namespace. Are you missing an assembly?", but the class is exist in that namespace.
I build Advocar project and re-add the assembly to the Import project and it did not help. Both project are in .NET 2.0.
Any Idea please?
Check the access level of new class added into the namespace.
Ok. I found the solution although I dont know what would cause that.
since 40% of all the classes that I have are the same code, so to create a new class I just copied and pasted one of the existing class and made changes on that one.
So to solve my issue, I deleted the new classes and I just Add New Item and create a blank class and past the code that I needed to the new class and it fixed that.
Its look like some kind of caching issue that although you rename a class and so on, but it still has some record from past.
After importing an older C# file into a new WPF appliction, "using System.Windows;" gives an error message. This wasn't just one C# file, it was a number of them and I put them into a new project.
What reference do I need to locate or change to get using System.Windows to resolve properly?
Add a reference to System.Drawing for your project.
This problem stems from resources which are associated at the Project level (References), which I had not added to the new project.
To use old code unchanged, I can add a Reference to System.Drawing, and use the old Windows Forms framework.
If I want to convert the code to WPF, I need to add an association (Reference) to the new project. I can get using System.Windows; to work by adding a Reference in the new project to "PresentationFramework".