I want to run a backend API in ASP.NET Core on a macos, the project was developed on Windows machines so there was used IIs Express to run it, but i don't know what I need to change to have it run on macos.
I found that IIs Express don't work on macos, so I need to use some alternative as I think
You can refer this blog to run your application.
How to Build Cross-Platform .NET Core Apps
I have tried to create a app in windows, then copy it to macos. I can run it successfully in macos by using visual studio mac, and also tried in Rider. You also can using the dotnet-cli to start the application.
According to the official doc, it suggests to using Nginx.
Related
I discovered the joy of publishing instead of using an installer package (which I do use for my older VS2015 solutions targeting .Net Framework).
Using all defaults, I was able to publish my application to a folder, then copied all 34 files/folders to the permanent home of this app. I chose a folder in the C: root. This all works fine, and when I call this new application from my MS Access application, it works perfectly.
Now the problem occurs when I deploy the program to my user's PC. I do this by copying the entire folder off the C:\ folder to his C:\ folder.
When we run the MSAccess app, which runs the new console app by using the Shell command, the console app does not run. No error is generated, and I do not know if the Shell command is returning a helpful response code or not.
I believe the issue is that customer does NOT have .Net Core 3.1 installed. When I was publishing a platform-specific version and choosing .Net Core 3.1, the application was expecting that framework to be already installed on the user's PC (which it's not).
I read this article about deploying self-contained applications.
https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-vs?tabs=vs157
When I followed the instructions to publish a self-contained application, I ended up with 12 or 14 items only, none of which was the EXE for my program. There IS an apphost.exe with the same size as the program exe the old publish method used to create.
What am I doing wrong? Thanks...
Update:
I figured out how to publish the application, using the self-contained option. This created a much larger deployment, as expected. After copying this to customer's PC, it still didn't work. When I tried running it via a command window, it mentioned missing DLLs. Sorry, couldn't save DLL names. Now I wonder if it's best to go back to publishing a platform-dependent version, then have .Net Core 3.1 installed on customer's PC before retrying the application?? Thanks...
Turns out installing the .Net Core 3.1 runtimes on customer's PC, then publishing the platform-dependent version of my app works fine. Much smaller to deploy, and all the required files are all there when needed.
Thanks for the comments...
I neeed to run a windows form application on Raspberry Pi made using C#.
I have tried the option of installing a windows os and running the exe application . It does work but the issue is that it is slow and takes a lot of time for the application to work.
Is there any possibility to run the exe directly on raspbian ?
You can't natively run winform applications under Linux, but maybe you could try using Wine or one of the other compatibility tools for Linux.
If you are the author of the application you could port your app to GTK# which is a desktop GUI Toolkit for Linux with C#
What I'm using right now:
You can execute Windows Forms Applications written in the .NET Framework (newest 4.8, no longer continued) with mono.
On the raspberry pi, if I recall correctly, you can "sudo apt install mono-complete" and then run it via the terminal: "mono YourApp.exe"
As I said, it sadly only works with .NET Framework Applications (or maybe on rare occasions with .NET 6.0 too, hasn't worked for mine though), you may be able to change that in Visual Studio though (or new project and then copy/paste the code).
The only downside is that you are then using an older version of C#, meaning some things may be different from what you are used to.
Basically, my school only has Mac computers, however they're telling me to learn C# and to do so using Visual Studio. However, the school program is fairly new and the projects are self-guided. I've been coding in C# using Visual Studio and it's been working so far - it's run successfully and everything. However, I can't seem to find a way to export or publish my code into a standalone application. I've tried using WineBottler to convert the .exe into a .dmg, but I can't seem to make it work.
How should I do this? Moving to Windows or another IDE/compiler isn't an option. I've currently been creating my projects in a Console App, but I could change that if necessary.
After quite a bit of experimentation and research, I've found that while you can publish a .NET Core Console App within Visual Studio for Mac, the feature is not supported within the GUI of the program (for whatever reason).
In order to publish, you have to Control-Click on the solution in the Solution Explorer and open the project in the command line by clicking Tools > Open In Terminal.
Once there, type in the command:
dotnet publish -c Release --framework netcoreapp2.1 --runtime osx-x64
This will create a self-contained program for 64-bit mac os on the v2.1 .NET Core framework. The runtime can be changed for different operating systems and the version number for netcoreapp can be changed based on which version you're using and what is compatible with any plugins for your program.
The final product will be found in yourprojectfolder/yourprojectname/bin/Release/netcoreapp2.1/osx-x64/publish
You should have no issues creating and compiling .NET CORE console apps using a Mac. These apps will have limited .NET functionality, do not have .exe files, and are platform agnostic. Here is a quick guide you can reference to decide if .NET CORE is the right option for you.
If you are trying to create WinForm apps or something similar, you cannot do this on a Mac. There are "work arounds" using Wine or other tools, but my experience with those options has been suboptimal at best. If you need to create apps like this, then your best option is to program on a Windows machine. Perhaps ask your school to enable bootcamp and install Windows 10 OS on one of the Mac machines.
You can generate exe using the terminal if you are on OSX. You can follow this post
It requires :
Visual Studio For Mac
A .cs file
Few lines in terminal
I'm not a developer but I needed to code a simple web page for a POC.
For that I used VS2017 for mac to make a MVC project and all is fine when I run it on "my machine" (yeah I know it a common issue :P), I mean I can build the solution and open the web page, this page is used to create/register an user at AWS Cognito.
But when I run this same solution in a windows machine with Visual Studio 2017, the project builds without errors the web page opens but I can't make the API calls to aws cognito, this machine has open access to internet, so it's not a network problem.
I think it can be a software problem, I'm using C# and .NET 4.5 + the AWS SDKs referent to the project.
Anyone has an idea?
Thanks in advance
I wrote a small app built with the Microsoft Surface SDK in C# (.net 4 / 4.5), however people without the SDK seem to be unable to run the app.
I'm building it with Visual Studio 2012 and have Local Copy in the Microsoft.Surface reference set to true, but still nothing.
Is there any way that others can execute the app without installing the SDK?
There is the Microsoft Surface Runtime which you should distribute along with your application.