简体   繁体   English

如何使用ASP.Net 5 MVC预览模板项目中的命名空间?

[英]How can I use a namespace from ASP.Net 5 MVC preview template project?

In Microsoft Visual Studio 2015 I have two projects: the first is created on the basis of ASP.NET 5 Preview templates (Web Application), the second is Unit Test project. 在Microsoft Visual Studio 2015中,我有两个项目:第一个是基于ASP.NET 5 Preview模板(Web应用程序)创建的,第二个是单元测试项目。 In order to test some methods in the first project, I want to add a reference to it in my TestProject. 为了测试第一个项目中的某些方法,我想在我的TestProject中添加对它的引用。 However, I get an error "A reference to "MVCProject" could not be added". 但是,出现错误“无法添加对“ MVCProject”的引用”。 How can I resolve this problem? 我该如何解决这个问题?

UPD: Target platform for TestProject is .NET 4.5.2 (I tried also swith to .NET 4.6, didn't get any difference in terms of my question). UPD:TestProject的目标平台是.NET 4.5.2(我也尝试过使用.NET 4.6,在我的问题上没有任何区别)。 In MVCProject I find only the following info: Solution DNX SDK Version: Version=1.0.0 beta5, Platform= .NET Framework, Architecture=x86 - and that's all. 在MVCProject中,我仅找到以下信息:解决方案DNX SDK版本:Version = 1.0.0 beta5,Platform = .NET Framework,Architecture = x86-仅此而已。

for asp.net 5 you should not add "Test Projects", instead you add a class library package project for testing with xunit. 对于asp.net 5,您不应添加“测试项目”,而应添加用于使用xunit测试的类库包项目。 this article should help you 本文应该对您有帮助

then you should have no problem adding a reference 那么您添加参考应该没有问题

暂无
暂无

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

相关问题 如何在Visual Studio 2013中编辑ASP.Net MVC C#项目模板文件? - How can I edit ASP.Net MVC C# project template files in Visual Studio 2013? 如何创建自定义ASP.NET MVC项目模板? - How can I create a custom ASP.NET MVC project template? 如何在ASP.NET MVC 5.1项目中通过控制器的动作使用标准JSON格式器? - How can I use the standard JSON formatter from an action of my controller in an ASP.NET MVC 5.1 project? 为什么我不能将Asp.Net 5 MVC 6项目中的EF 6.1.3与类库一起使用 - Why can't I use Class Library with EF 6.1.3 from Asp.Net 5 MVC 6 project 如何将SQL Server CE用于我的ASP.net MVC成员/授权项目? - How can I use SQL Server CE for my ASP.net MVC membership/authorization project? ASP.NET MVC + WF + WCF + SERVICE LAYER我如何在一个项目中使用它们? - ASP.NET MVC + WF + WCF + SERVICE LAYER how i can use thats all in one project? 如何在ASP.NET Webforms网站项目中一起使用Webforms和ASP.NET MVC? - How do I use Webforms and ASP.NET MVC together in an ASP.NET Webforms Website project? 如何从ASP.NET MVC Project中的输入类型“文件”中获取文件名? - How can i get filename from input type “file” in ASP.NET MVC Project? 我如何引用MVC项目中的类,该类使用asp.net核心从数据库中检索数据 - How can I reference a class in MVC project that retrieves data from database with asp.net core 如何从asp.net mvc 2项目中的非控制器静态类生成URL? - How can I generate url from non-controller static class in asp.net mvc 2 project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM