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.
Related
I can't successfully build basic ASP.NET web app targeting framework 4.7.2.
I built a docker image with a base image for Windows Server Core 2019. On this image I installed VS 2022 Enterprise and took Azure development, .NET desktop development, ASP.NET and web development modules, including recommended ones.
For dotnet core solutions everything works fine, but for dotnet framework I am getting such errors:
packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(31,5): Error MSB3758: An error has occurred during compilation. error CS0014: Required file 'alink.dll' could not be found
packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(31,5): Error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Build.Tasks.Core.dll". The task factory must return a value for the "TaskType" property.
I additionally installed .NET Frameworks: 4.5, 4.6, 4.6.1, 4.7.1, 4.8, but it didn't help.
Locally, I am able to build it without any problems. I checked the image if VS 2022 was installed without any issues and it looks fine as well. All environment variables are also in place. I thought the issue was related with some missing .NET Frameworks with SDKs, but it still persists.
Installing Redistributable C++ 2012-2022 didn't help as well. I am using MSBuild 17.
What I still might be missing?
I want to create an agent for Azure DevOps and as a reference I use the Dockerfile from Microsoft documentation. One difference is that before the start script, I run my custom script to silently install the VS 2022 with the modules I specified earlier.
I use Azure DevOps pipelines to build the solution, and the VSBuild#1 task.
I was finally able to solve the problem I had. It turned out that the base windows server core image didn't contain all of the needed prerequisites nor Visual Studio. Solution was to use extended windows server core image with sdk 4.8. This is strange, because Visual Studio already delivers everything for sdk 4.8. I think the extended image must have had something else that didn't come with the VS installation.
I have a Angular/.NetCoreWebApi app running in Visual Studio Code on my Mac and I need to run some older WCF/SOAP calls. I can't do this with .Net Core (doesn't support WCP/Soap protocols) so I was told the best solution is to create a .Net Web API project and have my .Net Core project call it to make the web service calls.
I'm on a Mac! So is this even possible knowing that .Net doesn't run on a Mac??
If I can create a project to make these calls on my Mac, which project type do I select to create in the terminal/command prompt, when doing a >dotnet new -h?
If what I want isn't possible, is it possible to run the .Net app inside a docker on my Mac?
If these are all a NO I can use my windows machine at work instead, but I'm looking at the types of projects to create on my Win machine on the command prompt and I still don't see a .Net Web Api app. Only .Net Core projects. I have the .Net framework 4.8 packages installed! And I can create the .Net project in Visual Studio, so is this the only way to create it?
.Net Core supports WCF clients, so there shouldn't be any reason for you not to use the ASP.NET Core Web API project type, assuming you mean you need to call a WCF service external to your project as a client, and not to host a WCF service.
This user showed that it was possible by manually adding and invoking the svcutil tool.
I'm interested in figuring out how to use the Twilio API, and I am building an ASP.NET 5 application using the Twilio API with MVC6 (trying to follow this tutorial). So far, I have created an empty ASP.NET 5 application, and I added "Twilio" to the dependencies in project.json. I get the following error:
"The dependency Twilio 4.0.3 in project TwilioTest does not support framework DNXCore, Version v5.0"
I notice that when I remove "dnxcore50" from "frameworks", the error goes away.
I'm not sure what this means or how to approach it. I'm still pretty new to .NET and trying to wrap my head around how all of the pieces fit together. Does it mean that Twilio isn't compatible with DNXCore? Since all I want to do for now is learn how to use Twilio, could I essentially remove the dnxcore50 framework from the project and continue working through building the app?
The Twillio NuGet package is dependent on the full .NET stack, which in project.json frameworks terms is DNX451. What that means is, you can add the Twillio NuGet package and remove the DNXCORE50 reference and your project will run as expected and you will be able to use the Twillio API. As far as I know the only major drawback is that your ASP.NET Core project will no longer be cross platform as you are now dependent on the full .NET Framework stack which is only present in Windows.
In a nutshell, you should be fine unless you are planning to deploy to Linux/OSx. Hopefully as ASP.NET CORE becomes mainstream more 3rd party SDKs will be built to require only DNXCORE50 as a dependency.
Another option don't use the Twillio Libraries and code against their REST API. See documentation here: https://www.twilio.com/docs/api. But I wouldn't recommend this if you are deploying to a Windows environment.
Twilio is working on their .Net Standard (Core) library. In the meantime, I've published a .Net Core port of their library to unblock our current projects until we get the official update. Feel free to take it for a spin:
Install Twilio.NetCore from Nuget.
And you can check out the source on Github.
I make a c# application project. this project run on my computer good, but in other computer says you must first install .NET Framework 4.0 to run this application.
How to embed .net framework 4.0 into c# project.
Thanks
You can't embed the framework into your application sine it needs to be installed on the client machine (not just xcopy'd like your app).
You'll need to create an installer which will take care of detecting and installing the required framework version before installing your application.
There is a tutorial here which shows how to create a setup project.
Once everything is set up, go to Project > [project name] Properties, click the Prerequisites... button and check .Net Framework 4. By default, the setup will download the Framework from Microsoft, so it will need an internet connection.
i am working on a dotnet C# web application which was initially created with VS 2003. My goal is to upgrade this application to Dotnet 4.0 without changing any functionaltiy. The solution has 9 projects (1 web + 8 Library projects). The Web project refers the 8 libraries in DLLs. To start off, I created a New project in VS2010 and added the all the Project files from the existing source code. Every time i add a project file to my solution, i was prompted with the Converison wizard and i completed the conversion wizard succesfully and now the solution works fine. After the conversion, i noticed that Except the "Web" project, other projects are converted to Dotnet 2.0 but not 4.0. My application runs without error if i run it locally using VS2010. My questions are
Why the Class libaray project did not upgrade to 4.0? Currently the
Web project is shows up as Dotnet 4.0 and Libaray projects shows up
as Dotnet 2.0.
Can i deploy the application to IIS 7.0 with the
Dotnet runtime of 4.0? Will the Dlls created in version 2.0 work if my application
uses Dotnet 4.0 runtime version?
Please help...
If your'e migrating now, why not move directly to Visual Studio 2012, instead of 2010?
Anyway, what you can do is open the project properties in each of your projects, and change the target framework to the .NET framework 4.0.
Then if you get any compilation error you can probably easily solve it individually. This should be relatively easy if your projects are not too big.
As for your specific questions:
The automatic conversion would only change the format of the solution/projects to be compatible with the new version Visual Studio. It shouldn't change the target framework but you can change that yourself.
Yes, assemblies targeting .NET 2.0 can be loaded and used from assemblies targeting .NET 4.0.
1) Upgrading the solution/projects file only upgrades it's format so you can open it in VS 2010. It will usually leave the targeted .NET setting at the previous value. These are two seperate things. The wonderful thing about VS 2010 is it let's you target whatever version of .NET you desire, so no longer do you need multiple version of VS installed to support differnt .NET versions. It didn't change the targetted .NET version because it leaves it up to you. You can change it under the project settings and recompile your library projects to regenerate the DLLs
2) You will need an application pool for .NET 4. .NET is backwards compatible in that a .NET 2.0 app can run on a machine with .net 4 installed. However, the application pool for 2.0 applications must be separate from 4.0 apps. So it's just a matter of putting the app under the right app pool.