I have a .net 5 web api that consists of a solution with most of projects being .net 5, but two of them are .net framework (v 4.7.2).
The web api works fine when I run it, and referring to .net framework projects is not a problem.
Now I am trying to upload this solution to azure app service using Github actions. The build step works fine, but when publishing, I get the following error:
C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\5.0.202\Microsoft.Common.CurrentVersion.targets(4288,5):
error : MSB4803: The task "FormatUrl" is not supported on the .NET
Core version of MSBuild. Please use the .NET Framework version of
MSBuild. See https://aka.ms/msbuild/MSB4803 for further details. [path
to my .net framework .csproj]
I am trying to avoid updating the project to .net 5. Is there a way to configure my github actions to be able to publish .net framework projects as well?
Related
I recently migrated a dotnet framework v4.7.2 WCF service with the upgrade-assisstant tool to NetStandard 2.0. the project successfully migrated and compiled, BUT I couldnt start the service either from visual studio nor dotnet cli.
the Error I get from dotnet cli tool is :
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found.
AND the error I get trying to start the service from visual studio, solution explorer -> right click on wcf project -> debug -> start new instance is:
A project with an output type of class library couldnt start directly.
P.S when the WCF service was still dotnet framework v4.7.2 I could easily start the service doing the above mentioned procedure in visual studio.
As I know .net 4.7.2 is the lowest real version that supports .netstandard 2.0 In this link.
You can back it up and upgrade to 4.7.2 to try it out.
WCF server APIs are not supported on .NET Standard or .NET Core/.NET 5+, so there's no good way to migrate such an app forward.
Upgrade Assistant tries to figure out whether a project should upgrade to a library or an exe based on the previous project type. For this project, Upgrade Assistant guessed it was a library since there was no traditional main method and it wasn't a web app or some other project type that the tool understood as executable. Regardless of whether it upgraded it as a .NET Standard library or as a .NET 5 exe, though, it wouldn't work because WCF server APIs are only supported on .NET Framework.
It might be nice if Upgrade Assistant alerted you to that early in the process so you knew upgrading wouldn't work for this type of project. I thought it had a feature like that, but it must have missed for this specific project. You could provide feedback on the tool's GitHub page (https://github.com/dotnet/upgrade-assistant/issues).
As far as how you can actually upgrade WCF server stuff, you'll need to re-architect using a different technology like ASP.NET Core, gRPC, or CoreWCF.
I have an ASP.NET Core project. It is .NET Framework based. I have been working with .NET Version 4.6, but am happy to upgrade to 4.6.2 or 4.7. I have both installed on my machine. The referenced NuGet packages are numerous and version numbers varied. But, it seems that roughly speaking, I am using version 1.1.3 of ASP.NET Core.
I want to upgrade to the latest version of ASP.NET Core and ASP.NET Core MVC but every time I try, I get this error message:
Could not install package 'Microsoft.AspNetCore.Mvc.Core 2.0.0'. You
are trying to install this package into a project that targets
'.NETFramework,Version=v4.7', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author.
After Googling for this, I came across this disconcerting Github thread:
https://github.com/aspnet/home/issues/2022
This seems to imply that at some point, V2 was not supported by the .NET Framework. I read through the thread to some extent, but these words from another user basically some up my thoughts on the subject:
I really don't know what is happening. Why do have many dotnet this
and that. This is really crazy. How do we have keep tracks of this?
No proper documentation on migration from one to another.
The OP was edited to say this:
Edit: the "no .NET Framework support for ASP.NET Core 2.0" plan has
been officially cancelled and running ASP.NET Core 2.0 on .NET Desktop
will be supported in the next previews. For more information, read
Announcing ASP.NET Core 2.0.0-Preview1 and Updates for .NET Web
Developers or watch .NET Standard 2.0 and .NET Core 2.0.
I guess that means that Microsoft planned to fix the problem at some point. But, what I can't work out is whether or not Microsoft have actually fixed this problem.
Is anyone running ASP.NET Core on .NET Framework? Which .NET version? How did you get it working?
As per #Melbourne Developer's suggestion:
Make sure you download the latest .Net Core 2.0 installers.
Create new ASP.Net Core Web Application
Choose .NET Framework from dropdownlist in wizard and ASP.Net Core 2.0
Copy content over to new project. Fixing up all namespace issues/compilation errors
I am unable to find any documentation, or examples, of an ASP.NET MVC Core app running under the full framework. It is supposed to be supported, but as I said I cannot find any documentation of how to configure a project for this, and have not been able to work it out myself.
Has anyone got this working and can provide advice/sample on what needs to be done?
I am able to create/run ASP.NET Core 2.0 project with Full .NET framework 4.6.1, I followed below steps-
Created new project using ASP.NET Core web application under Web category-
On 2nd step, selected Web Application (Model-View-Controller)
csproj looks like this- <TargetFramework>net461</TargetFramework>
My Environment is-
Visual Studio 2017 Community 15.3.3 version
.NET Core 2.0 SDK
I'm trying to access the Google Drive API, and I can successfully log in a user with the use of the Google+ API. I've been following this guide:
https://developers.google.com/drive/v3/web/quickstart/dotnet
I added the needed libraries with the nuget package manager, but still it can't find the GoogleWebAuthorizationBroker class. The weird thing is, that when I add the same Google.Apis.Auth package version 1.18.0 to a simple console application it works flawlessly, but when I add it to my .NET Core 1.0 preview 2 project it simply won't recognize the aforementioned class.
A screenshot including the added packages:
My .NET Core source code (no class found here):
My console application source code and references (the class can be found here for some reason):
Thanks in advance!
Your console application is running on the full .net framework. That is why GoogleWebAuthorizationBroker is getting resolved there.
I have had the same issues with the Google.Apis against .net core and I ended up running the asp.net Core project on top of the full .net framework. When the Google components work, I plan on switching the framework back to .net core.
I replaced the dotnet framework with the 461 framework like this:
"frameworks": {
"net461": {}
}
And I also had to comment out/remove the dependency on Microsoft.NETCore.App like this:
"dependencies": {
"Google.Apis": "1.19.0",
"Google.Apis.Auth": "1.19.0",
"Google.Apis.Calendar.v3": "1.19.0.675"
//"Microsoft.NETCore.App": "1.1.0-preview1-001100-00",
},
You could also run against both frameworks - I tried doing that, and when you publish the website you go
DOTNET PUBLISH -f 461
or
DOTNET PUBLISH -f netcoreapp1.0
Depending on the framework.
You also then have to select from a dropdown in visual studio, the framework you run against, which ended up being more of a problem. Easier to just comment out the dotnetcore1.0 framework when not needed and just go dotnet publish on my build pipeline ...
There is a thread on the Google .net apis github page about .net core compatibility here. https://github.com/google/google-api-dotnet-client/issues/872#issuecomment-259710682
Expected support for these classes are guesstimated at early 2017.
Hope that help you?
With the release of .NET Core RC2 Microsoft made it so there are now 3 Web Application templates:
ASP.NET Web Application (.NET Framework) — The old
ASP.NET Core Web Application (.NET Framework) — the new, to be hosting on Windows only
ASP.NET Core Web Application (.NET Core) — Linux, OSX, Windows
I am trying to use the new Core Web Application template but without trying to target Linux, OSX, Windows so it seems like the ASP.NET Core Web Application (.NET Framework) is perfect for me. It took me a while but I learned that in order to add a class library that will work with this project type you need to add a Class Library (.NET Core) and change the frameworks section to only be net461 to match the Web Application.
"frameworks": {
"net461": { }
}
My Question:
What is the difference between creating an ASP.NET Core Web Application (.NET Core) and in project.json making net461 the only target framework
and
just creating an ASP.NET Core Web Application (.NET Framework) project which only includes net461 by default.
Are there other differences that I am not aware of like the way the projects are published, etc.?
What is the difference between creating a ASP.NET Core Web Application
(.NET Core) and in project.json making.NET461 the only target
Framework
It's the same thing as making an ASP.NET Core Web Application (.NET Framework) project. The type of project between the two is determined by the .csproj file and you changed it in your .csproj from targeting .NET Core to targeting the .NET Framework. In previous release/beta versions of ASP.NET Core it was possible to have both Frameworks in a project.json file (which has been replaced by a simplified .csproj file in .NET Core 2.0 which more .NET developers are familiar with) but you could only publish to one.
just creating a ASP.NET Core Web Application (.NET Framework) project which only includes.NET461 by default.
Are there other difference that I am not aware of like the way the the projects are published, etc
If you target the .NET Framework and not .NET Core your app cannot be cross platform and your app can only run on Windows and not Linux/Mac.
The reason for there being separate ASP.NET Core Web Application (.NET Core) and ASP.NET Core Web Application (.NET Framework) is because the latter allows you to make use of functions, packages or 3rd party libraries that are dependent on Windows and the same .NET Framework or higher will be required to be installed on the machine.
The former doesn't have the .NET Framework requirement but allows your app to be cross platform and when you publish your app it publishes all the dependent .NET Core dll files to the publish directory in that way circumventing the .NET Framework installation requirement.
It will also affect compilation as if you target .NET Core and make use of a Windows specific function or package you will get a compilation error.
You can easily switch between the two by adjusting your .csproj to target the one or the other.
Microsoft Docs
You should use .NET Core for your server application when:
You have cross-platform needs.
You are targeting microservices.
You are using Docker containers.
You need high performance and scalable systems.
You need side by side of .NET versions by application.
You should use .NET Framework for your server application when:
Your application currently uses .NET Framework (recommendation is to extend instead of migrating)
You need to use third-party .NET libraries or NuGet packages not available for .NET Core.
You need to use .NET technologies that are not available for .NET Core.
You need to use a platform that doesn’t support .NET Core.
Update (2018/10/30)
It has been announced that ASP.Net Core 3 which has a release date in 2019 Q1, will only support .NET Core and NOT .NET Framework
As announced on the .NET Blog earlier this month, .NET Framework will get fewer of the newer platform and language features that come to .NET Core moving forward, due to the in-place update nature of .NET Framework and the desire to limit changes there that might break existing applications. To ensure ASP.NET Core can fully leverage the improvements coming to .NET Core moving forward, ASP.NET Core will only run on .NET Core starting from 3.0. Moving forward, you can simply think of ASP.NET Core as being part of .NET Core.
Customers utilizing ASP.NET Core on .NET Framework today can continue to do so in a fully supported fashion using the 2.1 LTS release. Support and servicing for 2.1 will continue until at least August 21, 2021 (3 years after its declaration as an LTS release) in accordance with the .NET Support Policy.
First see the difference in project.json files when you create ASP.NET Core Web Applications targeting different frameworks.
As per your question, if you change the framework in ASP.NET Core Web Application(.NET Core) project.json only to have net461 and save, it'll restore the packages and will give the following error.
If you remove Microsoft.NETCore.App dependency and saves the file, It'll again restore the dependencies and won't give any error.
If you notice the first image, this has finally become a ASP.NET Core Web Application with .NET Framework.
I was confused at first as well. The main difference is that ASP.NET Web Application (.NET Framework) is the normal asp.net that we have been using. It contains App_Start folder web.config, Global.asax etc.. (Like MVC5,You get the idea..).
Whereas ASP.NET Core Web Application (.NET Framework) is a core framework(MVC6). (Not dependent on System.Web). Brand new project.json.. startup.cs and program.cs etc... And it supports all the old libraries of .net framework as well.
with .net core, you can run your web pages application in Linux or mac os whereas the .net will only be good for windows, i.e. less portable.