ASP.NET 核心 1.0 模拟
ASP.NET Core 1.0 Mocking
我按照这个 ASP.NET Core 1.0: hints to get started 教程和其他人尝试在我的 ASP.NET 核心 MVC 项目中进行一些模拟工作。但我只得到这个:
Package moq.netcore 4.4.0-beta8 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package moq.netcore 4.4.0-beta8 supports:
- dotnet (.NETPlatform,Version=v5.0)
- net35 (.NETFramework,Version=v3.5)
- net40 (.NETFramework,Version=v4.0)
- sl5 (Silverlight,Version=v5.0)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
目前有解决办法吗?
我的project.json:
{
"version": "1.0.0-*",
"testRunner": "xunit",
"dependencies": {
"xunit": "2.2.0-beta2-build3300",
"APP.Portal": "1.0.0-*",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"moq.netcore": "4.4.0-beta8"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
}
我的NuGet.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
您可以尝试为受支持的框架添加导入。
类似于:
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
编辑: 我发现这个 post 对于理解 .net 核心中的框架和导入很有用 - https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about/
我按照这个 ASP.NET Core 1.0: hints to get started 教程和其他人尝试在我的 ASP.NET 核心 MVC 项目中进行一些模拟工作。但我只得到这个:
Package moq.netcore 4.4.0-beta8 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package moq.netcore 4.4.0-beta8 supports:
- dotnet (.NETPlatform,Version=v5.0)
- net35 (.NETFramework,Version=v3.5)
- net40 (.NETFramework,Version=v4.0)
- sl5 (Silverlight,Version=v5.0)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
目前有解决办法吗?
我的project.json:
{
"version": "1.0.0-*",
"testRunner": "xunit",
"dependencies": {
"xunit": "2.2.0-beta2-build3300",
"APP.Portal": "1.0.0-*",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"moq.netcore": "4.4.0-beta8"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
}
我的NuGet.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
您可以尝试为受支持的框架添加导入。
类似于:
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
编辑: 我发现这个 post 对于理解 .net 核心中的框架和导入很有用 - https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about/