[英]Adding mvc project to asp.net project
I'm currently in the process of trying to set up my final year project to begin writing but I'm struggling to do so. 我目前正在尝试建立我的最后一年的项目以开始写作,但我为此而努力。
Basically, I have an existing project that uses asp.net and need to add a new MVC project where they can run together. 基本上,我有一个使用asp.net的现有项目,需要添加一个新的MVC项目,使其可以一起运行。 The asp.net project will handle the login but with have a simple link to the mvc project.
asp.net项目将处理登录,但具有指向mvc项目的简单链接。 The issue is I can't get the from the asp.net project to the MVC one to work correctly.
问题是我无法从asp.net项目到MVC正常工作。
I don't want MVC inside the asp.net project but in its own project inside the same solution. 我不希望MVC在asp.net项目中,而是在相同解决方案中其自己的项目中。 I've looked all over for some kind of answer but all I can find is how to add MVC inside an asp.net project.
我一直在寻找某种答案,但我能找到的是如何在asp.net项目中添加MVC。
I can do this with two asp.net projects but am as of yet unable to get an asp.net project working with a new mvc project. 我可以使用两个asp.net项目来完成此操作,但到目前为止还无法使asp.net项目与新的mvc项目一起工作。
Any help or advice would be appreciated. 任何帮助或建议,将不胜感激。
Thanks 谢谢
It's really difficult to understand your exact problem, just on the basis of info provided, apologies for not asking for clarification in comments, as i can't post comments on question requiring a reputation of 50, which at the time of writing i don't have. 仅根据所提供的信息很难理解您的确切问题,很抱歉没有在注释中要求澄清,因为我无法对要求声誉50的问题发表评论,在撰写本文时我没有没有。
@Phil has answered correctly as to how to add a new project to solution, but your comment says that you are not able to reference to MVC project through links in existing project, something like @Phil已正确回答了如何向解决方案中添加新项目,但是您的评论说您无法通过现有项目中的链接引用MVC项目,例如
href="~/MVC/somecontroller/someaction/someparameters"
href =“〜/ MVC / somecontroller / someaction / someparameters”
If that is something you're after, then the actual logic behind this working is that those two projects have different paths and you'll require to setup virtual directories on same path. 如果您要这样做,那么该工作背后的实际逻辑是这两个项目具有不同的路径,并且您将需要在同一路径上设置虚拟目录。
You haven't mention that you're using ASP.NET 4.5+ MVC 5 or ASP.NET 5 MVC 6 as procedures are different. 您没有提到您正在使用ASP.NET 4.5+ MVC 5或ASP.NET 5 MVC 6,因为过程不同。 For the help of future readers i am posting for both platforms in Visual Studio.
为了将来的读者的帮助,我在Visual Studio中发布了这两个平台的文章。 Screenshots are from Visual Studio 2015 Enterprise, but it's the same across most(if not all) versions after Visual Studio 2012
屏幕截图来自Visual Studio 2015 Enterprise,但在Visual Studio 2012之后的大多数(如果不是全部)版本中,该屏幕截图均相同
ASP.NET 4.5+ MVC 5 ASP.NET 4.5+ MVC 5
ASP.NET 5 MVC 6 ASP.NET 5 MVC 6
Hope that helps 希望能有所帮助
For Visual Studio 2013: 对于Visual Studio 2013:
Visual Studio manages different projects are part of the same solution. Visual Studio管理不同的项目是同一解决方案的一部分。 I'm not sure how other versions of VS do this but it would be a very similar approach.
我不确定其他版本的VS如何做到这一点,但这将是一个非常相似的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.