简体   繁体   English

安装正确的DLL来解析cshtml视图中的ActionLink(...)和RouteLink(...)

[英]Installing the correct DLLs to resolve ActionLink(…) and RouteLink(…) in a cshtml view

I'm having an extremely hard time to get @Html.ActionLink(...) and/or @Html.RouteLink(...) to be resolved in my cshtml view, which should become part of an MVC5 AngularJS webapplication. 我非常难以在我的cshtml视图中解析@Html.ActionLink(...)和/或@Html.RouteLink(...) ,这应该成为MVC5 AngularJS Web应用程序的一部分。 I didn't expect it to be that hard. 我没想到它会那么难。 This matter is really driving me crazy. 这件事真的让我发疯。

I have tried: 我努力了:

  • installing (by Nuget or other method), 安装(通过Nuget或其他方法),
  • uninstalling, 卸载,
  • starting a new MVC project from scratch, 从头开始一个新的MVC项目,
  • vs2013Pro/vs2015 community edition. vs2013Pro / vs2015社区版。

The only thing I haven't try yet is switching to another computer. 我唯一尚未尝试的就是切换到另一台计算机。 But so far, I always end up that these 2 helper methods not being resolved in my cshtml view, regardless of the arguments added. 但是到目前为止,无论添加什么参数,我总是最终无法在cshtml视图中解析这两个辅助方法。

I have had moments that one or both of the above helpers were being resolved by Visual Studio successfully in IntelliSense, but for some reason, when I try to do further useful steps or even just save the project, the active DLLs are switched again, and IntelliSense stops working, and browser execution fails there. 我有片刻以上Visual Studio在IntelliSense中成功解决了一个或两个以上助手的问题,但是由于某种原因,当我尝试执行其他有用的步骤甚至只是保存项目时,活动的DLL将再次切换,并且IntelliSense停止工作,并且浏览器执行在那里失败。 Also ViewBag is most of the time unresolved. 而且ViewBag在大多数情况下都无法解析。 But that's less important in my case. 但这对我而言并不重要。

It even seems like some agent always makes the DLLs that I need vanish, and replace it by always the same incomplete or old dll versions. 甚至似乎某些代理程序总是使我需要的DLL消失,并用总是相同的不完整或旧dll版本替换它。 I can't get this under my control. 我无法控制这个。

My cshtml view starts like 我的cshtml视图开始像

@{
    ViewBag.Title = "My main view page";
    Layout = "MyLayout.cshtml";
}

<!DOCTYPE html>
@model AngularMVCWebsite.Models.MySituationMode
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <h2>@ViewBag.Title.</h2>
    <script>
    ...

and so on. 等等。 @Html itself is no problem to resolve. @HTML本身是没有问题可以解决的。

I may need to take into account that some DLLs are obsolete and replaced by others. 我可能需要考虑到某些DLL已过时并已被其他DLL取代。 But what's a good set of DLLs and their latest good versions? 但是,什么是一套好的DLL及其最新的好版本呢? Maybe I can install all at once using a specific recent nuget install? 也许我可以使用特定的最新nuget安装一次全部安装? From there I probably can continue without further help. 从那里,我可能可以继续而无需进一步帮助。

Can anyone put me in the right direction? 谁能把我的方向正确?

The main thing is to get the proper dlls in place and active and make sure that they stay in place after saving and quitting VS2015/VS2013. 最主要的是使适当的dll在适当位置并处于活动状态,并确保在保存并退出VS2015 / VS2013之后它们仍在适当的位置。

Any educated help much appreciated. 任何受过教育的帮助,不胜感激。

Have you tried installing the lastest Mvc Nuget Package? 您是否尝试过安装最新的Mvc Nuget软件包?

If it is already installed please update it. 如果已经安装,请进行更新。

From your console: Install-Package Microsoft.AspNet.Mvc -Version 5.2.3 从您的控制台:安装软件包Microsoft.AspNet.Mvc-版本5.2.3

Or you can install it from nugget directly. 或者,您可以直接从块中安装它。

I continued with this project on a W10 computer, leaving the Windows 7 environment, and all behaved much more as expected. 我在W10计算机上继续该项目,离开了Windows 7环境,并且所有行为的表现都超出了预期。 I still believe it should be possible to develop the web mvc5 razor application on W7, given the correct installation of extras, but I have no time to experiment with that any more. 我仍然相信,只要正确安装了Extras,就可以在W7上开发Web Mvc5剃须刀应用程序,但是我没有时间再进行尝试了。 Anyway, maybe others can tell what more should be installed on W7 (Professional ed) to allow vs2013/2015 mvc5 razor web development. 无论如何,也许其他人可以告诉应该在W7(专业版)上安装哪些工具,以支持vs2013 / 2015 mvc5剃须刀网络开发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM