fully compatible powerbi.api package with aspnetcore? - asp.net-core

i was able to get the sample asp.net embedded powerbi to work with my reports
now i have to migrate it aspnetcore
i was hopeful when i saw this post - seeing that someone was able to get it done
Embed Power BI Report In ASP.Net Core Website
so i:
started a new project with the aspnetcore
installed the powerbi package
now when compiling im getting this warning:
Package 'Microsoft.PowerBI.Api 2.0.11' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
i searched and couldnt find a powerbi package that was specific to aspnetcore
is there one? will there be a conflict crossing cores? or does it not matter?
UPDATE:
4.6.1 powerbi package does indeed work with aspnetcore 2
but looking forward to a powerbi package specifically coded for core

As you can see this is just a warning, not an error. That warning appears because .NET Core 2.0 applications can use some Nuget packages which target .NET Framework 4.6.1 (or less). However, this inclusion might fail if the referenced .NET 4.x package contains some API not included into .NET Core/.NET Standard 2.0
So, my advice - try to run your application. If it works well at the first glance - then, most probably that PowerBI package does not contain any not supported APIs and will work well further. If it fails right at start - then you will need to wait for the release of the new version of that package which targets .NET Standard 2.0.

Related

.Net Core Project Referencing .Net Frameork Projects Problems?

I have a question about .net Core project.
I have a .Net Core Project referencing other projects.
The problem is that a few projects show the warning saying that "Package 'XXXXX' was restored using .NetFramework, Version=v4.6.1.... instead of targer framework .NetCoreApp".
What kind of problems could I have?
Also can I deploy this in Linux for instance and still working fine?
warning showed
Thanks guys
Look at this thread - For a .Net Core 2.1 project, Why does Nuget restores .Net 4.6.1 packages?
What it basically means is the package you have loaded not suitable for .NET CORE, and was restored using a different version of .Net Framework.
Check if the package exists for .NET CORE (search thru NuGet Manager)
Regarding whether it will work on Linux or not - it depends on the package dependencies (e.g. if it is depending on WinForm for example, it probably won't work on Linux).
Even if it will work, I suggest finding a package suitable for .NET CORE.

Where are the nuget authentication packages for aspnet core 3?

I have a custom authentication component that is working with net core 2.2. I've started migrating the project to net core 3, but it seems like MS hasn't updated the authentication Nuget packages.
Until now, I was referencing the Microsoft.AspNetCore.Authentication package. The package still exists, but hasn't been updated to net core 3.0 (it's still on the 2.2 version).
I can't keep using it because net core 3.0 has moved the RequestPathBaseCookieBuilder type to a different namespace (so, at runtime, I'll get a tyoe loading exception). A quick search shows that only the Microsoft.AspNetCore.Authentication.OpenIdConnect has been updated to net core 3.0 (and if I add it to my project, then my component to work without any issues).
Anyone knows why MS hasn't still updated the other security nuget packages to version 3? Is there anyway to solve this without using the openidconnect nuget package (I'm only using it because it was the first that was updated and it will bring the correct Microsoft.AspNetCore.Authentication assembly that I need for my project)?
Looks like I was 10 minutes too late, but you posted the answer as a comment, rather than an answer, and I like questions having answers so I stop opening them when browsing the question search results.
Anyway, as you discovered, .NET Core 3.0 no longer uses packages for base class libraries (BCLs). Instead, they're just part of the SDK, so by targeting netcoreapp3.0 or netstandard2.1, all BCLs are just available. This should eliminate a lot of problems that earlier .NET Core projects had, particularly when referencing .NET Standard 1.x assemblies from netcoreapp2.x tfms. Although the largest benefit will be when all referenced packages target netstandard2.1 or netcoreapp3.0 or above.
Ok, so finally got it. The solution is to use the FrameworkReference element with the Microsoft.AspNetCore.App meta package.

.NET Core Runtime without installing

Can anyone help as to how to use the run time binaries found in the link below?
https://www.microsoft.com/net/download/windows
Basically, we are moving to .NET Core (we have been using .NET framework 4.0 for many years - so big shift as you can guess). I am kind of nervous to install .NET core on the production server (Windows Server 2012). Is it safe to install .NET Core on a server running .NET framework 4.0? If no, is there any way I can get the .NET Core runtime on to the server without installing them (kind of copying portal libraries) so that I can start with the beta testing of the app. Any help would be much appreciated. Thanks!
EDIT:
It is not duplicate, One of the main questions I had if I can use portable binaries on the server to run my app, without actually installing them (got the answer below, thanks again). Not sure someone down voted this without any reason. It makes the developers nervous to ask a question in StackOverflow. if they can mention the reason that would be great!
There are no issues when installing .NET Core and .NET Framework on the same machine. They are designed to allow them to be installed side-by-side.
However you do need to install the .NET Core runtime onto the server to allow the code to be run because the OS has native dependencies that need to be present. See this link for more information.
With .NET Core you can do framework dependent deployments (FDD) and self-contained deployments (SCD). FDD requires any shared assemblies to be present on the server i.e. System.* assemblies etc. but an SCD only requires the basic runtime/native dependencies. For an SCD your app deployment would include any .NET Core shared assemblies in it's deployment package.
You can read more about FDD and SCD here
Also there is more information about the native dependencies on different OS platforms here

ASP.Net Core 1.1 - Migration Failure

I know VS 2017 is only RC but there seem to be some major issues with migrating an ASP.Net Core 1.0 project to 1.1. The migration tool fails converting 2 of my 8 projects in the solution (I prefer to adopt a layered architectural approach for my projects) the sample project is located here. One project in particular is the class library I moved my web api controller methods into. In trying to re-create this class library it doesn't seem one is able to declare a controller class after installing Microsoft.AspNetCore.Mvc nuget. It is installed but the compiler is not finding the Controller, RouteAttribute classes, etc. The same issue occured with trying to setup a DI layer IServiceCollection. Nuget Microsoft.Extensions.DependencyInjection doesn't seem to be doing it.
The migration log quite honestly isn't really helping me. It seems to indicate an issue with my service project and the project.json file but as you can tell it is in the repository.
It feels like Microsoft is forcing us down the path of cramming all the "web" stuff into a single project file. Maybe these tools aren't far enough along yet but an RC would indicate they should be closer to ship ready?
ReciPiBook.Api
Message
src\ReciPiBook.Api\ReciPiBook.Api.xproj: Failed to migrate XProj project ReciPiBook.Api. 'dotnet migrate -s -p "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Api" -x "C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Api\ReciPiBook.Api.xproj"' exited with error code 1.
src\ReciPiBook.Api\ReciPiBook.Api.xproj: Could not find file 'C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Services\project.json'. Migration failed.
src\ReciPiBook.Api\ReciPiBook.Api.xproj: Backing up C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Api\ReciPiBook.Api.xproj to C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\Backup\src\ReciPiBook.Api\ReciPiBook.Api.xproj.
src\ReciPiBook.Api\project.json: Backing up C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\src\ReciPiBook.Api\project.json to C:\Users\xxx\Documents\Visual Studio 2015\Projects\ReciPiBook2017\ReciPiBookCore\Backup\src\ReciPiBook.Api\project.json.
I can't directly speak to VS2017 as I'm staying away from it as even though it's a RC, the core tooling is in ALPHA. The VS 2015 core tooling is at least in a "RC" state (actually only preview).
In VS2015 I migrated from 1.0.x to 1.1 manually (per https://blogs.msdn.microsoft.com/dotnet/2016/11/16/announcing-net-core-1-1/):
Download the 1.1 sdk
Change your global.json "sdk":{"version": "1.0.0-preview2-1-003177"} (yes it's a different version string).
Update all the project.json package versions from 1.0 to 1.1 (some are preview some arn't). Just open up the nuget package manager, allow preview versions, then install all the updates.
Fix any of your project.json tool entries as the package manager clobbers those.

Check if package is compatible with .net core

I started programming with .NET Core and ASP.NET Core and after reading many Docs/Tutorials i still am not sure of how to realize if a Nuget-(Meta-)Package is comptabile/usable within my .NET-Core-App.
How to check if a NuGet-Package is compatible with .NET Core.
E.g. the often recited Newtonsoft JSON. Is it compatible/usable - and how to see this?
Is there a list of all the available .NET Core packages?
(Like here it lists a few
key NuGet packages for .NET Core
). But since they say those are "key" packages i would assume there are more. But which?
The best way to understand compatibility is table here
In this table you can check what API version support NuGet package. If it is standard 1.0+ - it works with .Net Core
For checking (supported API version) dependencies on your package, you can check page of package on nuget.org or in your package manager
Here is an example for Rider
maybe that will be helpful - lots of popular packages https://github.com/thangchung/awesome-dotnet-core
I also don't see nuget.org mentioned anywhere so:
https://nuget.org
General rule of thumb for me is:
if package has a dependency on net standard or .net core, it will run with .net core(mind the versions also)
https://packagesearch.azurewebsites.net
Go to site and search for package to find its compatibility
Well, in fact you don't have to worry, the NET core application will indicate you if the package is compatible or not when you will run a dotnet restore command in your project.
Let say that you have the famous CSVHelper package registered in your csproj file :
<PackageReference Include="CsvHelper" Version="0.12.0"/>
Then, when you'll run any dotnet command such as build or run, you'll have the following input in the console in case of, here, cross-compatibility:
YourProjet/aspnetapp.csproj : warning NU1701: Package 'CsvHelper 0.12.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v2.2'. This package may not be fully compatible with your project.
Basically, it mean that NET Core application can use ASP.NET NuGet package, and so far, I've never cross on a non-compatible package. Even if version is incorrect, the build will get the most recent matching version of the NuGet package.
Hoped it answer your question.