Mono framework on Visual Studio 2019 - target/compile/debug - c#

Before any question, I did a lot of research on Google and S.O. , and I found only old and obsolete threads without any help for my problem.
so...
1. First question:
I wonder if it's possible to target the installed Mono framework directly from Visual Studio 2019.
I know that at the time of writing, Mono 6.4.0.198 is released and it supports almost all features of .NET 4.7 (and C# 7.0), so I created a simple project targeting FW4.7.2 and it works fine so far.
I just wanted to know if I can create a project entirely on Mono Framework with no other reference than Mono assemblies.
I did a lot of research and the only thing I found is this: https://erictummers.com/2012/01/25/target-mono-from-visual-studio/
but i'd rather not mess with the registry and assemblies files.
2. Second question:
I would like to build and debug my Mono code directly on the target machine (Raspberry Pi). It's possible to do so in Visual Studio 2019?
I managed to compile a C++ program directly on the RasPi, so i thought it might be possible to do the same for Mono/C#.
Any help would be very appreciated!

Related

How to install Google OR-Tools for C# in Visual Studio 2019

I am new to C# and Visual Studio, only did a bit of programming in Python with Anaconda and don't have an IT-background. So please excuse my fairly basic questions.
I am supposed to construct an optimization tool (i.e. the goal seeker from MS Excel) in C#. From my understanding I need an external package, so I looked for an open-source solution and found:
Numerical from Codeplex: https://archive.codeplex.com/?p=numerical
Microsoft Solution Foundation
Google OR-tools https://developers.google.com/optimization/install/dotnet/windows
Numerical seemed to be outdated, because at some point they migrated to GitHub, but I could not find it there. For Microsoft Solution Center I found a post, where someone claimed it doesnt get any updates anymore. So I finally discovered OR-Tools and downloaded/installed it according to the website.
What the website does not explain is how I connect the package with Visual Studio. I can't seem to find a "manually install"-button in the extensions-manager. In Python/Anaconda I would usually find a pip installer command for the console. Afterwards I could use the package with the import statement. How does it work in Visual Studio 2019?
We provide Nuget .Net Standard package for OrTools so you just need to add it as PackageReference in your csproj file.
ref:
https://www.nuget.org/packages/Google.OrTools/
https://learn.microsoft.com/fr-fr/nuget/consume-packages/package-references-in-project-files
warning: Since .Net Google.OrTools is a native package wrapping the C++
library OR-Tools, you'll still need the VS 2019 C++ Reditributable...

c# cplex api setup clarification steps

I am trying to start using the c#.net api for ibm cplex v12.6. However, I have trouble in the installation:
IBM page is telling me i need to set the compiler and linker:
https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.6.3/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/tutorials/Csharp/prerequisites.html
but what exactly do i need to do?
I am also confused by visual studio versions: is the community 2013 ok?
Thank you
Just run the CPLEX installer and take the default options. It will install everything you need to use CPLEX with Visual Studio (and a lot more as well), and should be compatible with any recent version of VS. Only real decision is whether to install the 32 or 64 bit version (or both). It'll put a mountain of stuff in somewhere like 'C:\Program files\IBM' but you can ignore most of it when working with C# and .Net
When I am working with Visual Studio and C#, I pretty much only ever use stuff in one folder such as:
C:\Program Files\IBM\ILOG\CPLEX_Studio1271\cplex\bin\x64_win64
Obviously you need to have a compiler and linker to do stuff with C#, and Visual Studio is the obvious choice. I have used many combinations of versions over the years (currently using 64-bit CPLEX 12.4, 12.5.1, 12.6.3 and 12.7.1 on various projects, with VS2008, VS2010 and VS2015, both pro and community editions) so I can't see why you would have a problem.

VST plugin and installing old VS extensions

I want to develop an VST plugin in C#. Looking around the internet there are not that many libraries in .NET that deal with VST plugins. The only thing I found is the VST.net library (https://vstnet.codeplex.com/). This thing hasn't been updated in a while.
The problem: I am having trouble setting it up the basic project. There are project templates for that project which are done for VS 2008/2010 which is .vsi file. I tried looking around for ways to open it in the latest VS (2017) but I was not successful.
Is there a way to open these in Visual Studio 2017 or should I have to install the older version of Visual Studio to make this work? Or if you have a suggestion for another library/extension that will help me with the development I would appreciate it.
Comments: I am aware that there is better support in C++ for this type of thing but my additional problem is that I have a project in C# that I would like to use and not be forced to rewrite the entire code base.
Thank you in advance for looking into this issue.

Visual Studio Code on Linux - How to run a C# application when "app.js does not exist", nor should it

I am running VS Code on Ubuntu 14.04. I am trying to run a C# web application which my team can run just fine in Visual Studio on Windows. The problem is that Code gives me an error message, "/app.js does not exist". No such file exists in our project, and I think I want to run it using "Startup.cs" instead, but despite trying to change the 'launch.json' file accordingly, another file that my team does not have, I still cannot get my project to run. Has anyone experienced a similar problem?
The .NET environment for Linux is currently in a pretty early state. Thus you can't do everything on Linux that you can enjoy on Windows.
If you want to develop an ASP.NET application then you should read this guide on how to setup the environment to work with Visual Studio Code.
If you have a C# application that can already be compiled and run on Linux then you can
create a script file which compiles the project and runs it afterwards
and let this script be executed as the build task in Visual Studio Code. Here is how to do it: How to prepare/configure development environment for C++ projects in Visual Code Editor?
Just for your interest: You can't currently debug C# projects in Visual Studio Code.
Perhaps you can try to open the project with Monodevelop? This is an open source IDE for C# that runs on linux. It is compatible with VS projects.
You will probably need to also install Mono (the open source .net runtime) to run Monodevelop.
You may even be able to run your web app with the Mono runtime, although it has been always a bit behind the official Microsoft .net runtime (you may get 'class not found' exceptions if your code uses libraries that are not yet implemented in the Mono runtime).

Using visual studio for developing mono applications

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).

Categories