I have 2 projects in my solution - .Net Maui(GUI) and ASP.Net Core Web API(API)
After adding a project reference to my GUI I get the following errors:
And I can find very little information on that, although I'm probably looking in wrong places. Can you give a hand with that?
Edit:
To complete/expand my question, I'm looking for a way to structer my solution a little bit better, I don't want to have everything in .NET Maui project.
I was following this tutorial https://www.youtube.com/watch?v=LrZwd-f0M4I
The author does create .NET Core project for API and Db connection
(EF Core) and then he uses the Api in .NET Maui
What am I missing?
Related
Ive build out a service as a console application, it exists across 2 different projects in the solution, both are in .NET framework. I am wanting to add in an api level to this and am wondering if I should continue to use .NET framework for the web application project, or if I can use .NET Core without messing anything up.
It all depends on the APIs you use in your application. If you only use APIs included in .NET Standard then no problem to use them in an application under .NET 6. Otherwise I join Kirk Woll to migrate your code under .NET 6 especially since the unification of the platform. I think it will remain only .NET 6 aka .NET core in the future.
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.
Last few months I create console applications with .NET framework and C#.
Now I want to create ASP.NET Core MVC projects, but I cannot choose any .NET Core template.
If I click "Console App (.NET Core)" or "ASP.NET Core Web Application" or any other .NET Core template, I can see this error message:
So, the problem occurs if I choose "Core", other templates work fine.
I have already tried to find a solution on Google.
What could be the problem? I reinstalled VS few times but did not help.
.NET Core does not support COM. COM is a Windows-only thing, and everything in Core is cross-platform. You must run on the full framework if you need to utilize a COM library.
That said, Microsoft has recently release a preview NuGet with some Windows compatibility APIs. This may allow you to utilize COM; I haven't tried it. However, the stated purpose of the NuGet is to make it easier to migrate existing .NET Framework applications to .NET Standard/.NET Core, so it's not considered something you would continue to utilize long-term. Rather, the idea is that you would actively work to migrate code that is not compatible to equivalent .NET Standard/.NET Core APIs, and then eventually remove the package entirely. As a result, it's probably not a good idea to go this route, even if it does enable you to use the COM library, simply because you're not likely to be able to stop at some point in the future.
Long and short, just run on the full framework.
Here's my story: I created a solution in VS2017 which contains 3 projects: .NET Core 2.0 dll to store my models, WebAPI (which uses EF Core 2.0 code first) and blank Web Application. In the blank project I would like to create a frontend Aurelia app. So, I did 'au new --here' on that project, selected TypeScript as my transpiler. Now, I have a solution with 3 projects which doesn't build because of:
Error TS5055 Build:Cannot write file 'XX/karma.conf.js' because it would overwrite input file.
I updated TypeScript to 2.3 by adding a proper entry to .csproj but still cannot compile my solution in VS2017.
My question is: how to add an Aurelia project to .NET Core 2.0 solution and get "au run --watch" works for it? I followed this post: http://mobilemancer.com/2016/10/19/aurelia-spa-typescript-dotnet-core/ but it seems not to consider all possible scenarios.
Please help me get started with .NET Core 2.0 Aurelia + WebAPI as I've been struggling with that for a couple of days.
You can look at the code from Aurelia-Typescript-Skeleton from GitHub https://github.com/aurelia/skeleton-navigation/tree/master/skeleton-typescript-aspnetcore
They have created asp.net core application and basic structure for aurelia and typescript.
You can install SPA Templates from ASP.NET core 2.0 with CLI command dotnet new --install Microsoft.AspNetCore.SpaTemplates::*
There you can find reach set of templates to start with ASP.NET core 2.0
Issue
Hi,
I am currently working on implementing a RESTful API in C# using ASP.net Core 2.0 in Visual Studio 2017 (running only via Kestrel, therefore no IIS).
Everything works pretty well, no issues there. The thing is that I now need to integrate and start this REST Server in another project (The REST server being only one of many functionalities that need to be executed at the same time, using a "bootstrap"). My issue here is that the latter project targets .Net Framework 4.5.2 whereas the REST server targets .Net Core 2.0. Thus, when I add the REST server to the references of my bootstrap application, I encounter a couple of errors saying that some of the Nuget packages target the wrong framework.
Solutions I tried
I searched over Google but most of the issues I found were people trying to do the other way round, i.e. adding a .Net Framework-targeted project in a .Net Core application.
The way I understood this .Net implementation support table, is that a .Net standard 2.0 project can support a .Net Core 2.0 project (I am probably wrong).
I tried a couple of things to make it work (which, spoiler alert, obviously and unfortunately did not work as I wouldn't be asking your help) :
Made the boostrap application target .Net Standard 2.0
Made the boostrap application target .Net Framework 4.6.1
Made the REST server application target .Net Standard 2.0 (which it of course didn't work, but I was kind of desperate..)
I made these target change by modifying the .csproj files.
I don't have the exact error codes because I reverted my changes a while back but they all were about projects not targeting the same framework.
So, in a tl;dr manner, what I am asking is :
Is there a way to add a .net Core 2.0 REST server inside a .Net Framework 4.5.2 (or 4.6.1 and higher/ or .Net Standard 2.0) project to start the server inside the application ?
Apologies for any english mistake as it is not my native language.
Don't hesitate to ask more info on my problem if I wasn't clear enough and thanks for the help !