我想使用 mvc6 创建一个网络应用程序并在 ASP.NET 网络应用程序(.Net 框架) 中搜索 ASP.NET 5 预览模板 我不能找到它,我在谷歌中进一步搜索。大多数解决方案都说要安装 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>
I have aleady installed
- .NET Core Tools for Visual Studio
- DotNetCore.1.0.0-VS2015Tools.Preview2
如有任何帮助,我们将不胜感激。谢谢
最佳答案
由于您指向的是软件包的发布版本,因此您的 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 />
作为 <packageSources>
下的第一个元素节点,以便您丢弃任何继承的源。
关于c# - dotnet 新项目无法恢复它的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38328413/