.Net Core - referencing another project in solution prevents System and other dependencies from being recognised - asp.net-core

I have a solution that contains a number of projects, one is an API, the other is an admin portal.
I'm trying to create another project inside the solution to hold all shared components such as database entities so they can be shared between the API and the Admin Portal.
I've created a new project called 'Common' and selected to use netcoreapp2.2 because if I just select a standard class library then annotations on the Entities don't work.
When I reference the 'Common' project from the 'API' project, which is also netcoreapp2.2, Rider(Mac) is unable to recognise any of the standard packaged used with the project such as System and System.Linq (and many others).
My experience with .Net Core is limited to only this project, so I'm sure I'm doing something wrong, I just can't figure out what it is.

I managed to fix this, I removed the 'Common' project from my solution and re-created it this time selecting the create the project as a Web Application.

Related

Change MS VS Intaller Projects programatically

I've created a sample VB.NET (.NET Framework) project for clarity, but have this issue in existing project too. I am puzzled, that it is missing any type of ProjectInstaller.vb (and associated designer and resource files):
So I cannot access initializing method and create event handlers.
I had similar problems with another project, a windows service, but then I finally found the ProjectInstaller.vb in the associated project (it would be "HelloWorld" in this case):
What do I do wrong and what to do to bring the ProjectInstaller.vb to life?
Notes:
apart this, installer gets compiled and using it, the packages get installed/uninstalled fine
I do have extension with templates:
I performed search in the solution directory for ProjectInstaller, found no results

Publish once while using RCL(Razor Class Library)

I used RCL to store the header and footer of my website and was referenced by several projects.
The projects referenced the RCL by the Project Reference of VS.
Every time I modify the RCL, I have to republish all the projects referenced it(By the web deploy). That's so troublesome.
Is there any way that only publishes once while I modify the RCL?
Thank you.
This is expected as the RCL is changed. You may need write some scripts to make it easy to publish the multiple projects after rebuilding the solution.
And you can also use any CI/CD tools for application lifecycle management, for example Azure DevOps.

Xamarin Forms code sharing

I'm working on a xamarin forms (PCL) project (A basic customer care chat app which is meant to run on Android and iOS only) that has just two xaml pages, custom renderers and few dependencies. This project is meant to be implemented into another existing project (which I don't have access to its source code) such that an action would be binded to a button on the existing app to show a page on my own project.
There is need for me to share my chat project with my client's developer but without exposing my source codes, perhaps compiling to dll or nuget package that would be added to the existing project to access my project's functions and pages. I have searched through the xamarin forum and here on stackoverflow but can't seem to lay my hands on a solution.
Is this possible at all? If yes, what am I missing? If no, is there any better option to use?
Please do note that the chat app completely done, so I'm hoping perhaps there's a way I could directly convert the project to a Nuget package.
Thanks in anticipation!
If the host application is a Xamarin Forms one:
-Move your cross platform shared code into a PCL or .Net Standard (ContentPages, ContentViews, Classes).
-Move your Renderers and platform specific code to Android and iOs Class Libraries.
Your client will have to reference your first assembly (dll) in their XF assembly in order to instantiate/manipulate your views/classes and platform specifics one on their Back-end side (taking into account your renderers, effects, etc ...)
A lot of Xamarin Controls Libraries Open Source hosted on Github are working like that. For example this one: https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout
If the host application is a native application, take a look into Xamarin forms embedding
Finally, I seem to solve the problem by enabling visual studio to build Nuget packages for the chat app project (summing up to 3 nuget packages) on project build.
Thanks #Rudy Spano and #Micah Switzer for your contributions

MVC 4 Add Controller Error Unable to retrieve metadata for my Model

I recently added a MVC4 Web Application to my solution and gave it a reference to my Common class library. The Common class library contains the models and context (EF Code First).
When attempting to use Visual Studio's scaffolding feature to "Add Controller" to the MVC4 Application, I get the following error:
Unable to retrieve metadata for 'Common.Models.MyContext'. Unable to
load one or more of the requested types. Retrieve the LoaderExceptions
property for more information.
I have found a lot of similar questions on stack overflow, but none of them address this specific error message for this specific scenario.
In my investigations, I found that if I remove all the added packages and third party dll's from the Common library, I am able to use the "Add Controller" function without error. This tells me that one of my packages or third party dll's is not where it needs to be (as indicated by the error message).
So my questions are these:
How do I find out which dll is causing the problem? Is there a Visual Studio scaffolding log file somewhere?
Say that I find the offending dll... Where would the dll need to live to fix the scaffolding error?
Make sure your web application project has ALL the required references from other projects. Just because your Common project has a dependency on a DLL doesn't mean that reference will be copied to your web project. You will have to add the dependant DLLs manually as references with Copy Local set to "true"
If you are using separates projects, check if EF has the same version number!

Web site to dll

I need to compile my web site, is it possible without converting to a web project first?
I think he wants to "protect" his code for any deployment.
If this is a .Net project you can try hide some code using codebehind components in ASP.NET.
Here is an small tutorial about it:
http://asp.net-tutorials.com/basics/code-behind/
For older projects you may have to build a cgi binary application, but as already mentioned here, add some more details to specify your problem.
I think you want a VS Web Deployment project. This exists as a separate project in your solution but can compile and copy the existing web project to a different directory.
There's a reasonable write-up of it on this blog with step-by-step instructions. You'll need to download and install the new project type separately though (2008, 2010)