在2015年VS针对运行新MVC6项目 [英] Targeting Runtime for New MVC6 Project in VS 2015

查看:447
本文介绍了在2015年VS针对运行新MVC6项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7中使用ASP.NET测试版7,2015年VS

当我创建VS2015新MVC6项目面向.NET 4.6框架,我的项目引用是这样的:

  DNX 4.5.1
DNX核心5.0

我不希望创建跨平台,并期望我引用如下(从其他的教程 S):

  ASP.NET 5.0
ASP.NET 5.0的核心

在ASP.NET 5.0文档:

在这里输入的形象描述

我所看到的在2015年VS(对DNX没有复选框选项):

在这里输入的形象描述

如果我只是手动破解project.json文件?

 框架:{
    dnx451:{},
    dnxcore50:{}
  },


解决方案

这文档,您可以选择该平台是由ASP.NET 5的previous测试版或preVIEW版本,所以无效的任何人。

您project.json看起来是正确的。

DNX是可以在各种底层.NET框架中运行,包括.NET框架4.5.1,4.5.2或最新的.NET Framework 4.6。

执行环境

.NET Core 5的也不是.NET框架5不过是一个模块化的运行时和库实现,包括.NET Framework的4.X.的一个子集所以,你可以把它叫做迷你.NET 4X。它不是用于Windows .NET框架的最新版本。最新的版本是的.NET Framework 4.6

如果您保留默认的project.json为

 框架:{
    dnx451:{},
    dnxcore50:{}
 },

然后当你发布你的项目,你会那么可以发布到任何.NET的核心或.NET框架。

CLR双赢= .NET框架窗口

核心CLR双赢= .NET核心

如果你不希望创建跨平台,您可以编辑您的project.json到

 框架:{
    dnx451:{},
 },

,你就无法看到.NET核心的目标DNC版本,当您发布您的网站的选择。

如果你需要使用更高.NET版本功能,或者,如果你要包含并引用一个类库,它本身的目标更高.NET Framework版本到你的项目,你就需要改变你的project.json瞄准相同或更高的.NET Framework版本如dnx452或dnx46

例如

 框架:{
    dnx46:{},
 },

只要你保存文件project.json您的项目将自动更新。您可以查看在输出窗口的进展情况。

I am using ASP.NET beta 7, VS 2015 on Windows 7.

When I create a new MVC6 project in VS2015 targeting .NET 4.6 framework, my project references look like this:

DNX 4.5.1
DNX Core 5.0

I don't wish to create for cross platform, and would expect my references to look like this (from other tutorials):

ASP.NET 5.0
ASP.NET Core 5.0

From the ASP.NET 5.0 documentation:

What I'm seeing in VS 2015 (no check box option for dnx):

Should I just manually hack the project.json file?

"frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

解决方案

That documentation where you can select the platform is from a previous beta or preview version of ASP.NET 5 so not valid anyone.

Your project.json looks correct.

DNX is an execution environment that can run on various underlying .NET frameworks, including .NET framework 4.5.1,4.5.2 or the latest .NET Framework 4.6.

.NET Core 5 is not .NET Framework 5 but is a modular runtime and library implementation that includes a subset of the .NET Framework 4.X. So you can call it mini .NET 4X. It is not the latest version of .NET framework for Windows. The latest version is .NET Framework 4.6

If you leave your project.json by default as

"frameworks": {
    "dnx451": { },
    "dnxcore50": { }
 },

then when you publish your project you'll then be able to publish to either .NET Core or .NET Framework.

clr-win = .NET Framework windows

core-clr-win = .NET Core

if you do not wish to create cross platform you can edit your project.json to

"frameworks": {
    "dnx451": { },
 },

and you'll not be able to see the Target DNC Version of .NET Core as a choice when you publish your site.

If you need to use a later .net version feature or if you you wish to include and reference a class library which itself targets a later .net framework version to your project you would need to change your project.json to target the same or later .net framework version e.g. dnx452 or dnx46

e.g.

 "frameworks": {
    "dnx46": { },
 },

As soon as you save the project.json file your project will automatically update itself. You can view the progress in the output window.

这篇关于在2015年VS针对运行新MVC6项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆