我想使用mvc6创建一个Web应用程序,并在 ASP.NET Web应用程序(.Net Framework)中搜索 ASP.NET 5预览模板 我无法&#39找到它,我在谷歌搜索更多。大多数解决方案都说要安装 ASP.NET Core 来获取预览模板,不知怎的,我通过安装 ASP.NET Core 来获得它。我正在创建一个新项目,如下所示。
在这一步之后,它正在为我创建新项目,但这些事情正在发生在我的新项目中。
对于我项目中的所有依赖项,我得到类似的错误:
NU1002 The dependency System.Runtime.Handles 4.0.1 does not support
framework .NETCoreApp,Version=v1.0.
这是我的project.json
project.json
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
这是我的nuget.config( C:\ Users \ Charitha \ AppData \ Roaming \ NuGet ):
<configuration>
<packageSources>
<add key="dotnet.cli" value="https://dotnet.myget.org/F/dotnet-cli/api/v3/index.json" />
<add key="dotnet.core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="RC2" value="https://www.myget.org/F/aspnetvnext/api/v3/index.json" />
<add key="AspNetCI" value="https://www.myget.org/F/aspnetcirelease/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
</configuration>
我安装了
- 适用于Visual Studio的.NET核心工具
- DotNetCore.1.0.0-VS2015Tools.Preview2
非常感谢任何帮助。感谢
答案 0 :(得分:1)
由于您指向已发布的软件包版本,因此NuGet.Config
应如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
如果您不想要全局更改Nuget.config文件内容,那么您可以创建应用程序本地的NuGet.Config文件,并确保添加<clear />
as <{1}}节点下的第一个元素,以便您丢弃任何继承的源。
答案 1 :(得分:0)
经过多次努力,我找到了答案。我不太确定这个,但我所做的只是用以下代码替换了project.json文件。
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
}
},
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
},
"net461": {
"dependencies": {
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
这可能对某人有所帮助。