首页 文章

ARM上的ASP.NET Core 1.0 RC2

提问于
浏览
3

我曾经在我的Raspberry Pi上运行ASP.NET Core 1.0 RC1项目 . 现在我已将项目转换为RC2,但似乎没有RC2的任何ARM构建 . 有人知道这个的状态吗?

1 回答

  • 0

    我找到了解决方法 .

    1. add the code in startup.cs like below.

    services.AddMvc().AddRazorOptions(options =>
            {
                if (Type.GetType("Mono.Runtime") != null)
                {
                    var myAssemblyPaths = new[] {
                 "/usr/lib/mono/4.5/mscorlib.dll",
                 "/usr/lib/mono/4.5/System.Core.dll",
                 "/usr/lib/mono/4.5/Microsoft.CSharp.dll"
                 };
                    var previous = options.CompilationCallback;
                    options.CompilationCallback = (context) =>
                    {
                        if (previous != null)
                        {
                            previous(context);
                        }
    
                        var references = myAssemblyPaths.Select(p => MetadataReference.CreateFromFile(p)).ToArray();
                        context.Compilation = context.Compilation.AddReferences(references);
                    };
                }
            });
    

    2. build on windows machine.

    3. copy all the web project to linux target including output files.

    4. run the app using mono.

    我的Web项目名称是AspNetCoreMonoTest .

    “/ root / AspNetCoreMonoTest”文件夹应该有project.json .

    请按以下命令执行 .

    cd / root / AspNetCoreMonoTest && mono bin / Debug / net451 / win7-x64 / AspNetCoreMonoTest.exe

    我使用了单声道版本4.4.0 . 并提到https://github.com/aspnet/Mvc/issues/4818#issuecomment-224775503

相关问题