12

I want to deploy ASP.NET web app on Linux with mono installed.

From what I know Mono is a targeting platform similar to .DNX 4.5.1 or .DNX Core 5.0. So I need somehow add it to targeting platforms in my project to compile and debug the project against it.

Surprisingly, I didn't managed to find any instructions. I'm creating a new ASP.NET 5/vNext project, and all I see is 4.5.1 and Core 5.0 compile targets. How to add Mono to that list?

yaapelsinko
  • 639
  • 1
  • 10
  • 18
  • I'm not sure VS2015 has a targeting pack for that (http://blogs.msdn.com/b/dotnet/p/dotnet_sdks.aspx), the easiest thing to do is to download Xamarin Studio or Mono Develop and compile it through there, the project types should be compatible (Mono Develop does have a problem with projects/solutions with spaces in the name last I tried though). – Ron Beyer Oct 09 '15 at 03:07
  • There is a thing - I've actually have seen some item to chose in VS2015, and it was "mono" in its name. I'm pretty sure it was about targeting. However, since then I've reinstalled my OS, and now that I want to work with mono intentionally - it's all gone... – yaapelsinko Oct 09 '15 at 03:31

2 Answers2

5

Compile from Visual Studio and target Mono

As extract from here

You can compile against Mono on Windows, from Visual studio with MonoHelper addin (using xbuild underneath).

There is also another solution, which is targeting a "Mono" .NET Framework profile from visual studio. Following steps come from here and it's for VS 2012 (but it should work for other versions).

  1. Create two registry keys:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0,Profile=Mono

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0,Profile=Mono

  2. Make a link to Mono directory inside of Microsoft References Assemblies Directory (you may need to run the following with administrator rights)

    cd "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Profile" mklink /d Mono "C:\Program Files (x86)\Mono\lib\mono\4.5" cd Mono mkdir RedistList cd RedistList notepad FrameworkList.xml

  3. Edit FrameworkList.xml

Paste the following inside FrameworkList.xml

<?xml version="1.0" encoding="utf-8"?>
<FileList  Redist="Mono-4.5" Name="Mono 4.5 Profile" RuntimeVersion="4.5" ToolsVersion="4.0" > </FileList>
Community
  • 1
  • 1
Fab
  • 14,327
  • 5
  • 49
  • 68
  • This add-in does not support Visual Studio 2015 (as it required you to download Visual Studio 2013 to install). :/ – XtraSimplicity May 23 '16 at 23:07
  • This actually does work in VS2015, but there is something missing to add the new profile in the list of available profiles when you create a new project. Instead, target the regular framework to create you application template, then save and retarget the application in the project settings. The Mono profile is there, and works properly. – Drunken Code Monkey Aug 07 '16 at 16:34
2

There was some Mono product/Mono for VS that integrates Mono into VS, but now there is none.

You should target .NET Core 5 in this case, as it is going to be the ultimate solution.

Mono does still provide some support for ASP.NET 4.* projects, but it would be difficult to assert compatibility as you need to deploy to Mono on Linux to verify. Even in those cases your project should target full .NET Framework just like what you do in the past. There is no Mono specific profile to target.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • So, I'm targeting Core 5.0 and assume it will just work. Then, do I need to compile my project at server side? Also, there is the "dnx-mono" package on NuGet, and with version 1.0.0-beta7 one could think it is something actual at this moment. Is that package somehow important for targeting a project for Mono environment? – yaapelsinko Oct 09 '15 at 05:18
  • @yaapelsinko none of DNX/.NET Core bits from Microsoft or other vendors are finalized yet, so it is really not the time to assert anything. .NET Core 5 will be ready Q1 2016, as well as DNX, so hope you can wait. – Lex Li Oct 09 '15 at 06:13
  • Well what I want is to know at least for current moment, how could I start to play with it. There are plenty of tutorials about ASP.NET 5 on Raspberry PI kind of stuff, but all of them describing some questionable ways to develop programs. I look at it and, well, yeah, I'll kinda sort of be able to repeat those helloworlds, but I don't see how to apply it to VS workflow. I haven't seen a single one about how to make a real world application, like adequate web-app that can be built in "traditional" manner and then deployed to the platform you choose... – yaapelsinko Oct 09 '15 at 10:35
  • @yaapelsinko most of the developers including me would find it too risky to study something that's still evolving. Considering the changes made among beta versions of DNX, I don't think most of the guys want to port a full solution but hello world. If you do want to take the challenge, start from DNX home page and source code and bless you will be lucky. – Lex Li Oct 09 '15 at 10:58