asp.net core 3.1 - Add reference from class library to web application in the same solution - reference

I have an asp.net core 3.1 solution, with web application project and another 2 class library projects.
files architecture
I am trying to add reference from one class library project to the other using Ctrl+".", but it doesn't give an option to do that in the IntelliSense.
How can I do the reference without IntelliSense ? (Adding it manually using CoronaPatients.Core also not working).
How to enable it from the IntelliSense ?

Well I have just discovered the right click on the project ->> Add ->> Project Reference... option, and check the project you want to reference to.
But still, why is it not in the IntelliSense ?

Related

mvc 6 add class library

I am using VS2015 (RTM) and have a solution with two projects:
1) An MVC 6 ASP.NET Web Application
2) A Windows Split-View App (Universal Windows)
I would like to also add a class library to the solution that can be referenced by both of the projects, but can't find a way to do it.
If I add a Web Class Library (Package), I can reference it via the web application, but not by the Universal Windows App.
If I add a Windows Class Library (Universal Windows), I can reference it in the Universal Windows App, but when I try to add a reference to the MVC 6 Web Application I get a couple of thousand reference errors.
Is there an easy way to do this, i.e. share a class library between an MVC 6 app and a Universal Windows app, or is it a non-starter?
The MVC 6 can’t reference the UWP class library since they are based on the different .NET runtime. MVC 6 is based on the .NET Core or Full .NET, the UWP is based on the .NET for UWP.
I did not have the MVC 6 installed in my machine to test. The portable library should work in this case, but I also failed to compile in MVC 5.
As a workaround, you can considering using the code sharing between UWP project and MVC project.
Create a new folder named share_code in the solution folder, put the common code in this folder. In UWP project and MVC project, Add -> Existing Item, then you can re-use the code in both projects.

How to add Storage reference?

This should be pretty straightforward, but can't work this out for myself I'm afraid!
The following line of code triggers the error:
using Microsoft.Xna.Framework.Storage;
Error: The type or namespace name 'Storage' does not exist in the
namespace 'Microsoft.Xna.Framework' (are you missing an assembly
reference?)
But as far as I can tell, I have added the reference: (Solution explorer -> right click References -> Add reference -> .NET tab -> scroll down to Microsoft.Xna.Framework.Storage -> select it -> click OK).
Microsoft.Xna.Framework.Storage shows up when I expand "references" in the solution explorer.
What am I missing?
EDIT
Okay on second look this might be to do with how I'm adding the references. When I search in the object browser Microsoft.Xna.Framework.Storage doesn't show up (but when I search, for example, for audio, Microsoft.Xna.Framework.Audio does show up). Is there anyway to check that when I click "OK" on the add reference pop-up that it is actually working?
I see two likely possibilities.
You have a mismatch of XNA 4.0 and XNA 3.1 (or previous) references in your project. If the Storage reference you added is from 3.1, you'll get this message. You can try removing it, and then looking specifically for the 4.0 version during add.
The device you are building for may not support the Storage mechanism. In particular, Windows Phone apparently uses a different storage mechanism (System.IO.IsolatedStorage http://msdn.microsoft.com/en-us/library/ff604992.aspx).
Hope one of these helps.
This question was asked a long time ago, but if anyone else is still looking for an answer, here is how i fixed it.
If you installed the Microsoft.Xna.Framework references by using the installer from Microsoft, then it installs in C:\Windows\Microsoft.NET\assembly. I found all of the Xna libraries in GAC_32 and Microsoft.Xna.Framework.Storage in GAC_MSIL.
You can also use the GAC to find libraries that aren't in Visual Studio's reference list. For .NET Framework versions before 4.0, the libraries are in C:\Windows\assembly, and the libraries for versions after 4.0 are in C:\Windows\Microsoft.NET\assembly.
It's actually been removed from Monogame by Microsoft.
Running: Windows 10, with integrated graphics card (Intel G45/G43), Visual Studio 19, Monogame 3.7.1
Project Structure: Solution > Game.Shared, Game.Android, Game.OpenGL (followed this guide on creating a Cross-Platform project, method number 3).
I changed the Target Framework in my OpenGL project from .NET 4.5 to .NET 4.7.x (the newest version), and I was able to build and deploy the app to an Android device. Do this by clicking the project and selecting Properties.
I simply commented out the line. App will successfully deploy to an Android device this way. The game will then deploy, but I can't get any content to load.
Have yet to see if I can deploy to an iOS device, I will update this post when I figure out if I can.
No nuGet's installed.

Writing a WinRT component using WRL

I have been using the project template called "Windows Runtime Component" that ships with VS2012 in order to create a C++/CX based WinRT component.
I now wish to do the same thing without using C++/CX but through WRL. When I do this, there are some things (referencing, automatic packaging with the main app project, Winmd-based intellisense etc.) that don't work in VS2012. How can I make sure that I can use WRL in my component project and still get the full IDE experience like I get with C++/CX based template?
Take a look at the Visual Studio project template for WRL components here:
http://visualstudiogallery.msdn.microsoft.com/346e6fbc-6508-43c8-af7f-9a922bb57128
This achieves a similar result both at design-time and at runtime as does the C++/CX based project template.

Sharing projects with MonoTouch

I have a class library project (developed in VS) which I want to share with a MonoTouch project I'm working on. The problem is that when I try to add a reference to the library project in MonoDevelop an error is displayed saying 'Incompatible target framework: v.NETFramework,Version=v3.5)'.
From what I've read on the web I have to create another class library project in MonoDevelop and then link all the project files from the original into it...I'll do this if I have to but i'd rather have a cleaner solution to this, if not a simple project file fix then maybe a script I can run...
Regards
Lee
A Portable Class Library would be the way to go, but unfortunately not yet properly supported in the current version of MonoDevelop with MonoTouch. Work seems to be in progress though.
You do have to create a class library project in MonoDevelop. The library has to be compiled with the MonoTouch version of the framework.
The reason for this is MonoTouch framework is based on the Silverlight lightweight version of the .NET framework.
See here http://docs.xamarin.com/ios/about/assemblies for more info.

Is it possible to create a stand-alone Monotouch class library?

I'm all about code reuse. One of the best ways in .NET/Mono is to create a class library. I have a few custom UIViews that I would like to place in a class library (.dll) so that I can redistribute it but for some reason I am not able to create a project that references monotouch from a stand-alone library. The only way to reference it is to create a full blown iPhone project -- not what I want.
Any help would be appreciated.
Under MonoDevelop project types C#->iPhone and iPad, I have
iPhone Window-based Project
iPhone OpenGL Project
iPhone Navigation-based Project
iPhone Utility Project
MonoTouch Library Project
Empty MonoTouch Project
iPad Window-based Project
Universal Window-based Project
You want MonoTouch Library Project. This will compile a DLL that can be referenced in another MonoTouch project.
I know this works because I have 2 projects that reference a DLL I created just for the benefit of reusing code.

Resources