How to publish a Windows-compatible executable from Mac? - c#

I just finished my first C# console app on Visual Studio 2022 on Mac and I need to publish it to a standalone executable app. I am able to get the exe on Mac working fine. But my teacher needs to open it on Windows. How can I do that?
When publishing, VS on Mac does not ask for the target runtime machine at all...
Thanks.

Sure, you can always publish for a different platform, e.g:
dotnet publish MyProject.csproj --runtime win-x64
This should give you a publish\win-x64 directory with a windows exe file in it. You can give that folder to your teacher.

Related

What is the difference between dotnet build and dotnet publish commands?

I am a little confused regarding dotnet build vs dotnet publish topic.
When I say difference, I mean what is the physical difference among them.
I see that dotnet build generates the same files as dotnet publish unless it is self-contained.
dotnet build will generate dll files in folder bin in your local project folder
dotnet publish will build, generate dll files and deploy in where you want.
For example, you can deploy to a hosting provider, to a file folder on your network (you can manually copy from there to a folder used by IIS), to IIS on your development computer as a testing environment, to a server on your company's internal network.
Read more "How to: Deploy a Web Project Using One-Click Publish in Visual Studio": https://learn.microsoft.com/en-us/previous-versions/aspnet/dd465337(v=vs.110)?redirectedfrom=MSDN

Cannot launch picoe/eto application on Mac OSX

Currently I'm developing an application for both Windows and MacOS.
Created a template application for MacOS (10.13.4) using Eto.Platform.Mac64 (2.4.1) nuget package. The application is built for Release build. The problem occurs when trying to launch the .app bundle.
Currently tried:
Opening the bundle using: open -a xxx.app. I got an error -54
using: sudo open -a xxx.app. The error is -10810
Giving all permissions for files inside for execution.
Disabling GateKeeper
Trying to launch the executable directly using mono, although the ETO platform checks if it's launched from .app bundle, and fails there
Launching the .app from /usr/local/bin
Launching the .app from ~/Applications/
Building Eto.Forms for MacOS separately.
Everything seems to point to permissions issue, but I can't seem to understand what am I missing.
Since I'm new with MacOS in general (mostly familiar with linux), any suggestions/help is greatly appreciated.
After checking the Console.app for logs I found out that com.apple.quarantine had marked the application as quarantined.
After xattr -d com.apple.quarantine MyApp.Mac.App/Contents/MacOS/MyApp.Mac
Everything works perfectly.
Thank you Curtis for your suggestions.

VB.NET published windows app doesn't run

TOOLS:
Windows 10 Pro
Visual Studio 2017 Pro
I created a VB.NET windows app GUI on my desktop computer,
published it,
copied the publish\ directory to a new target laptop,
logged into laptop and ran publish > setup.exe
it asked me to "install" and I said YES,
and app started, but hung, never displaying the GUI.
My app has two .DLL's of mine, but they are not in the publish\ directory.
I made a HELLO WORLD on original desktop, published, and it ran ok at laptop.
All of your dlls need to be distributed with your application.
Try manually move your dlls in the same folder of .exe file on target machine: if it works simply rebuild your setup incuding these dlls as dependencies.
The problem is solved. The target laptop needed installation of drivers from a vendor of some 3rd party middleware used in the app.
So, the packaging software wasn't smart enough to tell me the problem, and its error correction response was to just end without any error message.

Xamarin Studio On Mac - Open SLN and Create Install File

I am trying to make an installer file for mac for my application, and I can't find a way to do this. I am using Xamarin STudio and mono (not monomac), classic windows forms.
So here is what I did:
a)I created in Visual Studio on Windows a hello world app, with a simple window and a button
b)I installed Xamarin Studio in my VMWare mac os X image
c)I open the SLN from windows PC with xamarin studio
Everything is good. The solution opens, if I press run it runs on Mac using mono.
Now my problem. How do I compile and make the setup for Mac Os X so I can distribute my file (not in the store)?
I tried with right click on solution->tools->create package . But i Have no option to make a mac os x file. How can I do that?
***EDIT
I managed to compile and run the software on mac. I use the following code:
export PATH=/Library/Frameworks/Mono.framework/Commands:$PATH
export AS="as -arch i386"
export CC="cc -arch i386 -lobjc -liconv -framework Foundation"
# Build: --static
mkbundle "/VOLUMES/C/Proiecte/TestMono3/TestMono3/bin/Release/TestMono3.exe" --deps -o hello3
When I open hello3, it opens a terminal. Can this be avoided?
Also, if I don't use --static in mkbundle, can I still distribute the software without the user needing to install mono?
Thanks!
Do the following:
Switch your Project to the Release configuration from the Debug one.
In the Build menu, select Archive for Publishing.
The project will be built, archived and displayed in the Archive Explorer.
Select the desired version of the app and click the Sign and Distribute button.
From the Sign and Distribute dialog box, select Mac Installer Package and click the Next button.
Fill in the required Provisioning profile signing information. Note: You will have to have an developer account with Apple to correctly sign an installer, even for apps NOT released on the Mac App Store.
Continue with the rest of the prompts from the Sign and Distribute dialog box to create the installer.
I would suggest reading over the Publishing to the App Store guide as the steps are basically the same for a self-released installer package.

application run on windows startup after installation

I have publish my current project. I got the publish folder in my Project's folder. I installed my program and it works perfectly, but I need to know if it is possible that after installation (installer is from the Visual Studio 2012 when you publish the project) the program will start automatically upon windows start up.
You could have the installer create a link to your application in the Windows Registry, under the Run or RunOnce registry keys for Windows.
Here is more information about the Run and RunOnce registry keys:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa376977(v=vs.85).aspx

Categories

Resources