使用VS2017将项目从1.0和project.json
升级到1.1和.csproj
后,项目在VS中正常运行,但在使用dotnet run
启动时(或将其部署到Azure) ,所有观点都失败了。
错误信息是:
One or more compilation references are missing. Possible causes include a missing 'preserveCompilationContext' property under 'buildOptions' in the application's project.json.
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
+
public class _Views_News_Index_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyTeam.Models.General.PagedList<ArticleViewModel>>
.........
似乎视图无法编译,因为它们无法访问C#的东西。
我在.NET Framework 4.6.1上运行。这是我的csproj:https://github.com/severisv/MyTeam/blob/master/src/MyTeam/MyTeam.csproj
为什么会这样?我该如何解决?