How to target Mono framework from VS2015?

后端 未结 2 2089
挽巷
挽巷 2021-02-14 04:24

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 ad

相关标签:
2条回答
  • 2021-02-14 05:10

    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>
    
    0 讨论(0)
  • 2021-02-14 05:16

    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.

    0 讨论(0)
提交回复
热议问题