this might be a very stupid question but I was asked to provide a solution of a C# code that I wrote in Visual Studio together with "binaries" to run on a Linux or MacOS system.
How can I generate these binaries and how do they work? Does Visual Studio have some option to make them?
Thanks!
You need to target .NET Core, then you can run it on all major operating systems (with some limitations - i.e. there can't be any WPF or Winforms code). Select ".NET 5.0" as target framework. Then right-click the project in VS and choose "Publish". It's easiest to choose "Publish to folder" afterwards. In the options, you can choose the target operating system.
Related
Can a project made in Visual Studio for Mac be opened and run in Visual Studio on Windows?
I only have access to Mac, so unfortunately I cannot check it by myself.
It depends on the framework and libraries you target. Obviously if you use MonoMac or something with a Mac-specific UI, it'll run only on the Mac, but if you're writing a console app targeting .NET Core, by default it'll run fine on Windows. To write a cross-platform UI, you could try a third-party framework like Avalonia.
Edit: I should add that the .csproj and .sln formats used by Visual Studio for Mac are the same used by VS for Windows, so in general a project or solution for a cross-platform app (.NET Core) or library (.NET Core or .NET Standard) can be read by either Visual Studio.
In fact, I run Parallels with Windows 10 on my Mac with my repos in shared folders and will compile my cross-platform apps from whichever side on which I wish to run them. (There are line-ending considerations and other minor annoyances, but it works.)
So I'm new in the Visual Studio 2015 (Community), I liked the C# + XAML set so I start learning from scratch (I'm a VB6,Php,Js Dev) and I found the following issues.
a) How do yo do a standalone installation or release of a simple application?. (When I build the release it says: this application can only run in the context of an app container).
b) By programming on this set (c# + XAML), can I build applications for WinXP,Win7,Win8? (I found that the only requirement is to have .NET 4 installed, and when creating the solution on vs2015 target that framework).
I'm used to the fact that I can build my app and it will run just by installing the dlls on the client machine.
Thanks in advance for any answer or directions to solve this questions.
It sounds as if you have created a Modern app project. That will only run on Win8 and later.
If you want to use C# along with XAML, you should re-create the project as a WPF Application. When you create a new project, you would just look under the "Windows" section. Do not select "Universal" or "Windows 8" unless you intend to build for newer systems. WPF projects can be run on WinXP and later. I believe WPF also has a minimum requirement of .NET 3.0.
I have a Visual Studio project that compiles correctly on a Windows XP computer. I have copied the entire project to another PC running Windows 7 and it generates compilation errors.
The application uses .NET Framework 4.0 and Visual C++ redistributables, installed locally. It couldn't find these.
I realised that it was looking for the Microsoft.net in
c:\Program Files\Installshield\2012SpringLE\SetupPrerequisites
By right-clicking on the Microsoft .NET Framework 4.0 entry in the Redistributables (Installshield) window I was able to search for the merge module and corrected it to
c:\Program Files (x86)\Installshield\2012SpringLE\SetupPrerequisites
That overcame the .NET Framework 4.0 problem
However, I can't find the merge modules for the Visual C++ entry in the Redistributables (Installshield) window. Can anyone tell me where they are?
This is one of the big reasons that I suggest not only building on your machine. A proper CI build system should run on any number of build servers.
For merge modules you need to look at your merge module search path found in Tools | Options | Merge Modules Search those directories for your merge modules and copy them over to your new server.
For pretty much everything else you need to be aware of the Path Variables view (abstraction) what they are set to and how they are being used by various tables such as Binary, File, Icon and so on.
Personally I'm very meticulous when it comes to managing this and making sure everything is checked into source control properly. InstallShield will allow you to do very bad things in this area and not warn you what you are doing is problematic.
I created a C# project using MonoDevelop (Xamarin) on my Mac. From what I've read, it seems that Windows should be able to run the .exe if it has .Net installed. However, no such luck. Any pointers on getting this .exe to run in Windows?
Thanks
From monodevelop, with the project open, click Project, then settings. Under the build flag, click general. Change the target framework to .NET 4.0 Client Profile. Make sure mono is installed on windows.
http://www.go-mono.com/mono-downloads/download.html
Install Visual C++ 2013 redistributable package x86 and gtk# for .net.
See here.
How do I use Visual Studio to develop applications on Mono? Is this possible?
You just build the applications in Visual Studio, and run them under Mono instead of under .NET. The binaries should be compatible... but you'll need to make sure you don't use any libraries which aren't available in Mono - see the Mono Application Compatibility Guidelines.
(According to that page, you need to turn off incremental builds in Visual Studio though - a point I wasn't aware of before :)
See this article on how to run your apps while targeting the mono framework from VS.
Miguel has posted this entry a while ago, so it's quite dated. You can also try this and this (all hail Web Archive!)
Since version 2.0 MonoDevelop supports VisualStudio project/solutions file format. This means that you can use the same code base on Windows with VS and .Net and on Linux with MonoDevelop and Mono. That in my opinion is the best way to go about it. There are no major reasons to run application in Mono on Windows, other than for testing purposes and for that I'd rather set up a virtual machine to test the software in native environment.
I've posted an article on how to integrate Mono 2.8 (the build for .Net 4.0) into Visual Studio 2010 here - there's a link there to another profile built for Mono 2.4 (.Net 3.5) if that's what you're aiming for.
You can integrate the new Mono 2.8 profile with 3 simple steps:
Download the profile itself from here.
Unzip the contents of the profile Zip to one of the following directories:
32-bit systems: C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
64-bit systems: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
The "Mono" folder in the ZIP should be directly under the "Profile" directory.
Restart Visual Studio if it had been running, open the properties of the project you want to use with Mono, and select the Mono Profile for 2.8:
Note: You will not be able to select the Mono Profile straight from the New Project dialog box; for some reason, that list of profiles doesn't match. Create your project as a .Net Framework 4.0 project first, and after creation set the project properties to Mono.
If you've upgraded your MonoDevelop install to the latest version (as of today, anyway), this Visual Studio solution & Project file will open with no problem - no changes required at all.
If you encounter the problem that you need .NETFramework,Version=v4.0,Profile=Mono in order to run the application, the trick was to create registry key.
For running Windows 7 x64, it was: HKEY\_LOCAL\_MACHINESOFTWAREWow6432NodeMicrosoft .NETFrameworkv4.0.30319SKUs .NETFramework,Version=v4.0,Profile=Mono
I suppose for x86 it’s HKEY\_LOCAL\_MACHINESOFTWAREMicrosoft.NETFramework v4.0.30319SKUs.NETFramework,Version=v4.0,Profile=Mono
(Where v4.0.30319 would be the version of the current 4.0 framework installed.)
Yes, you can develop on Visual Studio and target Mono (Mono for x86).
Here is an answer I made on all the available possible alternative to compile against Mono on Windows. However, it's focused for Mono x86.
As a summary, let's list the possible choice for VS development:
MonoHelper addin
Mono Profile
For Android/Ios, you can also cross-compile and debug inside Visual Studio with Xamarin addin. Although it's not free for commercial huge applications, there a free version available to make small ones.
Note: For those who wonder why in the world I would like to develop in Visual Studio on Windows, instead of MonoDevelop on Unix, let say that developer experience in MonoDevelop does not compare to VS one (especially when it comes to debugger/refactoring, the last due more to Resharper than to VS itself).