views:

41

answers:

1

This is my project setup:

In visual studio I have a solution with a class library project for my linq2sql and an MVC web project.

I want to keep my models in the class library as I may build a windows app later.

I am trying to create a strongly typed view and have Visual Studio create the edit and details page dynamically but I can't get my model available in the 'View Data Class' drop down in the Add View tool. I can obviously type the class in but it wont let me select a 'View Content'??

Any help/comments would be great.

thanks

+2  A: 

The Visual Studio T4 template that drives this dialog populates the 'View Data Class' dropdown from classes contained in the "Models" namespace of your MVC project, so if the class is not in that namespace, it won't appear in the dropdown.

The fix would be to modify the T4 template so that it could reflect over model classes from another namespace, but that would be a non-trivial modification.

http://blogs.msdn.com/webdevtools/archive/2009/01/29/t4-templates-a-quick-start-guide-for-asp-net-mvc-developers.aspx

Robert Harvey