I am doing some research for a new project. This project will use .NET/C# for the backend and now I am investigating about the best way to integrate the frontend in the same repository.
There will be multiple client apps like a web based CMS and Android/iOS mobile apps. Because of the team expertise NX, Angular and Ionic has been chosen as client technologies.
I know dotnet has a template to create an Angular SPA project, since there will be multiple client apps and we want to share code between them I wanted to convert it in an NX monorepo but beside this article (not working for me) I didn't find how to do it. I came across nx-dotnet but wraps a C# backend inside a native NX monorepo (I am trying to do the opposite: NX in a dotnet project).
Is there any tool or docs about converting the dotnet Angular template in a monorepo? What is a good practice to share code between multiple client apps in a dotnet solution?
I thought about the following alternatives:
Init the NX monorepo in a folder and treat it like a normal node app (not a dotnet project)
Use Angular Workspace feature
Related
I have a .NET 6 ASP.NET Web Api project that uses Swashbuckle. I'd like to easily generate a corresponding client library for each build/release of the API. Here is what I was thinking, from a high level:
Make an API change to a controller, push the change up
GitVersion calculates a semver version based on the change (fix, feat, etc)
Pipeline builds the API project and bundles it into a docker image
Pipeline should also generate a C# client library using the same semantic version from the API and publish that to a private Nuget feed.
The last point is the salient one as far as this question is concerned. This is the only way I know to accomplish this at the moment:
Create a client project in my solution along with the API project
Set it up to run nswag tool as a post-build event that spits out generated C# files
Compile that client project
Deploy the client library as a nuget package
I know that the open API spec is available at http://localhost:5054/swagger/v1/swagger.json while the web API is running, so in my build pipeline, I imagine I'd need to actually run a debug build of the server API in order to access it.
I don't really like this solution because it's clunky. It requires invoking a separate 3rd party command line tool and requires me to run my rest API server to access the OpenAPI spec file.
I did some googling around and I saw that there might be a way to greatly simplify this using ServiceProjectReference, but I'm honestly not sure how that works. It makes it appear as if I can skip the 2 clunky parts I talked about above and drive everything from msbuild itself via XML properties.
What is the cleanest/most concise and modern way to achieve what I'm trying to do? Is there any merit to the ServiceProjectReference stuff above?
I'm working on TO-DO management solution which has two separate asp.net mvc core web applications and one web api application as;
- Admin panel web app. ( Doing CRUD operations on Todo list )
- Front office web app. ( it will list todo items )
- Webapi web app. ( Also it will list todo items )
How to share one Sqlite db file between those projects ?
I need to give some full path of the Sqlite file in solution so every application should look this path/db. Also I'm using entity framework core, so solution has entity-migrations as well.
I don't want to use MsSql, MySQL, MongoDB etc. Please don't suggest them as a solution. I know "MVC framework Areas" feature. And I know I can host Webapi and Web app on same project but i don't want to combine these projects. Samba share, windows file share is not an option as well. I will use shared hosting as well so I can't use "/var/local/share/app.db" or "D:\app.db" or a temp path etc. So how can I solve this problem?
I'm using Ubuntu OS. Entity freamwork core, All projects uses Asp.net Mvc Core 2.1, C#
What is the best practice to share a library (also C# project) between Windows UWP app and a .NET Core web app?
I have the following solution setup starting from scratch:
Solution
UWP App
Lib (With functionality I want to use in both other projects.)
.NET Core WebApp (2.2 or maybe 3.0)
As far as I could figure out, the only solution is, to create two projects for the lib, which share the same .cs files. But this feels a bit like a workaround and I am looking for a "clean(er)" way.
You can share a .NET Standard 2.0 library between those projects, see Microsoft's documentation.
Note, that you cannot use any classes specific to .NET Core or the UWP in such a project.
I need to call a UWP function that can talk with USB Serial Port from a WebAPI in ASP.NET Core 2.1 but at compile time Visual Studio 2017 get the following error.
Error NU1201 Project SerialPort is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Project SerialPort supports: uap10.0.17134 (UAP,Version=v10.0.17134)
WebAPI project and UWP project are working well on Raspberry PI3 with Windows 10 IoT as a separate projects. My need is to use UWP and ASP together but seams that is not possible. Asp.NET Core 2.1 seams doesn't support UWP classes for serial port communication and UWP seams not supporting ASP.NET WebAPI integration. How the two worlds can cooperate?
Tanks
AFAIK, it is not possible to add the reference for the UWP project from .Net core project at present. It may support when the .Net core 3, you can refer .NET Core 3 and Support for Windows Desktop Applications about mote detail.
Based on the description, it seems that you want public the hardware info via the web API. If I understood correctly, you may consider developing a web server by yourself and implement the business logic. You can refer the thread below about how to implement a web server in the background app:
Building a Windows 10 IoT Core background webserver
I am having a similar problem. I think the easiest way might be to reverse the logic. UWP reaches out to WebAPI, rather than WebAPI reaching out to UWP. The WebAPI stores the data, the UWP app gets the data via an http client, and in my case to manage state, the UWP app will store the most recent copy of a JSON file from the API to preserve state in case of power failure. If the power comes back on, it will read the most recent file stored locally prior to reaching out to the API for new data.
Can anyone clear angular, angular cli & npm? I am going to start with Angular project. Unfortunately my client already have project developed in some version of Angular (+.net core). I am newbie to angular.
I am trying to configuring that project on my local machine and facing too many version conflicts error. Submitting those error (one by one) here doesn't make any sense to me. Rather, I would need more clarity/intro/relations between angular, angular cli & npm.
Thanks.
Well, Angular is Angular. Angular CLI is a command developed in Node that helps you generate the boilerplate of an Angular project, so you don't have to do the repetitive, error prone work of preparing a new project by hand. This command uses npm to download the different dependencies the generated boilerplate needs.
Angular CLI let's you start a development web server too, to assist you during the development.
This is a very high level explanation. If you are totally new to Angular + .NET Core development, I would recommend you to check this book. It helped me a lot when I was in your position.