t4mvc

T4MVC and virtual directory

落花浮王杯 提交于 2019-12-25 07:39:25
问题 I'm using T4MVC in my project . but after deploying to a virtual directory e.g "/app" when I run the site all addresses were wrong . for example instead of being content/site.css it's /app/content/site.css and the browser can't find it . for example I write : <link href="@Links.Content.bootstrap_min_css" rel="stylesheet" type="text/css" /> that renders to <link href="/app/Content/bootstrap.min.css" rel="stylesheet" type="text/css" /> instead of <link href="Content/bootstrap.min.css" rel=

Does T4MVC work with Visual Studio 2010 Beta 2 and .Net 4?

末鹿安然 提交于 2019-12-24 06:01:58
问题 I cannot get the current build of T4MVC (2.6.02) to work with an ASP.NET MVC 2 project compiled against .NET 4 in VS2010 Beta 2. There is one error: The C# 2.0 and C# 3.5 compilers are no longer supported. Templates will always be compiled with the version 4 compiler instead of 'v3.5' as specified. Which is easily fixed by changing <#@ template language="C#v3.5" debug="true" hostspecific="true" #> to <#@ template language="C#" debug="true" hostspecific="true" #> And then the .generated.cs

Generate urls using T4MVC in a controller action

柔情痞子 提交于 2019-12-23 07:27:28
问题 I am using t4mvc to generate links in my project. I would like to generate urls in a controller action, can this be done using t4mvc? 回答1: Yes! string url = Url.Action(MVC.Views.Index()); .. for example. You should get the same set of objects you get in your views, just access the MVC object and pass it to Url.Action(). Some more notes about using T4MVC in a controller action here: http://www.davidferguson.me.uk/Blogs/Post/strongly-typed-actions-views-and-controllers-with-t4mvc 来源: https:/

T4MVC alternatives for ASP.NET 5?

自作多情 提交于 2019-12-22 08:06:32
问题 T4MVC is not supported yet or ever in ASP.NET 5. Is there any other similar solution ? I need strongly typed views and controllers names. 回答1: Looks like there is a side project called R4MVC but it hasn't been updated in 5 months. R4MVC is a Roslyn code generator for ASP.NET MVC vnext apps that creates strongly typed helpers that eliminate the use of literal strings in many places 回答2: As Stafford Williams pointed out, a side project was started a long time ago, but was stalled due to (at the

T4MVC Base controller doesn't have default constructor

坚强是说给别人听的谎言 提交于 2019-12-21 15:14:13
问题 My controller is inherited from anothe controller which doesn't have default constructor. T4MVC generates the following constructor which assumes base controller has default constructor: protected MyControllerController(Dummy d) { } How can I resolve this problem? Interesting enough, according to this page, version 2.4.00 "fixed issue when a base controller doesn't have a default ctor". I also found this SO question, but my base controller is not generic. 回答1: This should work fine if you

AssemblyBinding BindingRedirect not working for MVC4 app with T4MVCExtensions

不问归期 提交于 2019-12-18 05:04:36
问题 We have a large .NET web application that was MVC3, using T4MVC. We recently upgraded it to MVC4, and all is good except for T4MVCExtensions (version 3.6.5 from NuGet) is still dependent on System.Web.Mvc version 3. The runtime dependencies that you're supposed to setup in the web.config SHOULD be redirecting the assembly bindings, but they don't seem to be. The following exception occurs: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name:

T4MVC @Url.Action(MVC.Controller.Action()) Renders “?Area=” Parameter in QueryString

谁说我不能喝 提交于 2019-12-17 23:25:05
问题 I am rendering a menu from a Partial Action directly to the layout, using: @Html.Action(MVC.Menu.Index()) This action, determines which Menu partial to render. For instance, a public menu partial. Within these partials, I am also using T4MVC to render the links: <ul id="navHolder"> <li class="level1"> <ul class="mainMenu"> <li><b>@Html.ActionLink("Welcome", MVC.Home.Index())</b> ... For some reason, the Urls rendered by T4MVC include "?Area=" at the end: <ul id="navHolder"> <li class="level1"

Visual studio Error in adding any references OR installing and updating any packages (loading type library/DLL)

柔情痞子 提交于 2019-12-13 21:24:56
问题 Visual Studio 2012 RTM I have a MVC website project and i have some problem with adding some references; EDIT: My Visual Studio has some problems (More info in stackoverflow) I can't add any reference to my projects (even inside new solutions and new projects) I can't install any package (by "Packet Manager Console" or Manage NuGet Package) I can't update any package (by "Packet Manager Console" or Manage NuGet Package) For example if i update one of my packages, this will be fail with this

Pass an object in RedirectToAction() using T4MVC [duplicate]

点点圈 提交于 2019-12-13 17:56:01
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: pass data from Action To Another Action I have a view in which I submit a form and depending on the results I want to redirect to an action. The view that correspondes to and action is strongly-typed and it should accept a ResultsViewModel. I'm trying to pass the ResultsViewModel using T4MVC. Below is the code: [HttpPost] public virtual ActionResult AddEntity(string viewModel) { //Deserialize using Json.NET