I've been following this guide from MSDN about "Creating an ASP.NET MVC Areas Application Using Multiple Projects". Since ASP.NET MVC 2.0 is just preview one would imagine there to be some bugs.
My problem is, it simply doesn't work! At least not the way it's suppose to. After setting everything up and pressing F5, one would think that, this will work, neat! BEEEP. Wrong.
It doesn't find the Views in the child project! Because in my case it tries to search within ~/Views which of course is in the parent!
When debugging i see that it Does run the Controller inside my child project, but when using return View(); on that Action, it looks inside the Parent View-folders.
I ask, Bug or Feature?
Tried this in both Vs2009, Vs2010 with both Framework 3.5 and 4.0.
I put "multi project areas" in Google and came accross this post: http://forums.asp.net/p/1494640/3540105.aspx. Note specifically Phil Haack's response.
It appears that defining your views in the parent project is "functioning as designed" because of this entry in the MSDN post: Now that all the code is in place, the final step is to customize the build process for each area project. This customization causes some child-area files, such as the views, to be copied to the main project before the application is built.
The "problem" with the post is that it was defined for the beta where this build step was easily accessable. RC+ you have to point to the Futures assembly and assign the build step slightly differently if this is the path you choose.
If you don't like the direction this pushes you, the portable areas portion of MvcContrib Phil mentions is about as good as you're gonna get to an alternative.
I went through the same pain as you. This is what I did.
Made sure I was running MVC 2 RC (uninstall beta 2, install the RC).
Recreated the project from scratch.
No need to edit the csproj files, no need to create a routes.cs, and no need to edit global.ascx.cs, just right click the main project to get the context menu. From the Add menu item you can create a new area.
The views have to be in the main
project or you can use the
information in this post
http://forums.asp.net/p/1494640/3540105.aspx, which I plan on doing so the views are in each area.
It doesn't support the Multi-Project areas, but for now that's ok with me. The link above does point you in the direction for multi-project areas.
Related
I'm currently trying to move a solution with multiple projects from VS 2015 to VS 2019.It consists of one application and a couple of class libraries, target framework for each is .net 4.5.1. I have made a local copy of the solution to do this.
Most of the projects compile without a problem, but some of the one that are used as AddIns for the application don't.
When trying to build, doesn't matter if the projects by themselves or the whole solution, it fails because it's looking for itself. In my example picture, the project ZZ_WPF_Bank_AddIn is, while trying to build, is looking for the ZZ_WPF_Bank_AddIn in the bin folder of another project in the solution.
I tried just copying the dll from the original project, to see what happens, but it just points to the same dll missing in another project.
Has someone encountered this behaviour before? I tried googling it, but couldn't find anything useful.enter image description here
For anyone who might stumble upon this:
The solution to my problem was removing all references to projects inside the solution and adding them via Browse, noch via the projects tab on the left side. For some reason the bindings were not working properly after the migration.
I am looking for a way to to force Eclipse to refresh/rebuild its own main menu or even the whole view on runtime programmatically.
The reason why i need it this way is, because i have a plugin that iterates through a project and depending on the configuration of the selected project it loads a project specific plugin at runtime with:
FrameworkUtil.getBundle(this.getClass()).getBundleContext().installBundle(String).start()
Now the loaded plugin contributes to the org.eclipse.ui.main.menu extension point and even though the plugin is installed I don't see the new menu entry.
FYI: I am using Eclipse 3.x and E4 Tools
Now my questions are:
Is there acutally a way to refresh/rebuild parts of the Eclipse ui or maybe even the whole ui?
If not, can someone think of another approach? I thought of having a plugin which contributes only the menu and add the menu items programmatically.
But i couldn't believe that there is no way to refresh the view so i am asking this question.
I checked whether MMenu had a refresh method itself so i could get the object and just call the refresh method.
But in the end i didn't find a way to do this.
P.S. I am pretty new to Plugin Development and RCP so please don't blame me if the solution was obvious but i didn't realize it
Refresh/Rebuild UI
Short answer: no
In many places Eclipse extension points are loaded and information is stored in static fields (often in a Singleton). The plugin.xml data is not reloaded during the lifetime of the application, and certainly these bundles do not listen bundle events that would allow them to detect such changes.
Therefore, even if there were some method to call refresh on the whole UI, at least some (most?) of the code handling extension points would not see the effects of the new plugin.xmls.
Another Approach
To answer what you are trying to do, the "normal" thing to do would be to have each menu contribution's visibility be dependent on some expression, e.g. if the current selection adapts to MySpecialProject you could have it visible.
When you do it the normal way, and you leave everything to be lazily loaded, the java code for all those project type plug-ins will not be loaded until the commands are actually invoked for the first time.
To go the next step, you would probably have a main ui plug-in that defined a bunch of commands (e.g. build project, flash leds, format file, etc), but have no command handlers associated in that main plug-in. In each project type plug-in, have command handlers that are enabled when only the correct project type is active.
Assuming you have already worked through a basic tutorial on commands in Eclipse, there is a good advanced one on vogella.com that covers many useful features for being properly dynamic.
Right now Power Tools Beta 4 provides generation of views with a right click. This is fine as far as it goes but can cause issues because you have to remember to do it.
Is there any way that I can make it do the generation of views at compile time? (i.e. some sort of pre-build action or something?
Thanks!
You can use T4 templates for generating views I created a while ago. Take a look here for the EF5 version and here for the EF6 version. You will need to do some MSBuild work to make the T4 template run on Build. You can take a look at comments for this blog post where this is discussed a little bit.
EDIT
I also recently published Interactive Views for EF6 on NuGet so now you can have pre-generated views without having to generate them at the build time.
I am trying to use MVC3 with the Entity framework with Code First, but the code Template generation process in MS Visual Web Developer 2010 - is not detecting my Model in the models folder - giving a message - "No Model classes are available" - although I do have model classes for which I want to create controllers.
The templating option I've selected is "Controller with read/write actions and views using the Entity Framework".
I've uninstalled and reinstalled Web Developer 2010, but still having the same error.
Anyone know how I can get around this error?
xixonia's response worked for me. All I needed to do was build/rebuild the project and then everything worked as expected.
Rebuild all did not fix this issue for me... until I closed Studio, reopened and rebuilt all. Then it worked like a charm.
After create models must be build your project.
http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-entity-framework-scaffolding-and-migrations
I had this same issue and for me I had to go to the properties of the entity model in the entity model designer and change Code Generation Strategy to Default. It had been set to None because I had experimented with a DbContext generator.
I had this same issue.
While digging through my references, just before throwing the computer against the wall, I found that I had EntityFramework version 4.1 installed in the web project (by VS 2010 when the MVC 3 project was created).
I had 4.3.1 installed in the domain project (from nuget).
I uninstalled both of them and reinstalled from nuget.
Now everything is working again.
Hope this helps.
If you still have this problem then follow these steps to fix the problem:
1. Right click on your project and select [Manage NuGet Packages]
2. On the opened popup window, on the left hand pane, select Updates
3. On the right hand pane, at the very top right click on the Update All
During this process, it will ask you whether you want to overwrite the existing references (not sure about the exact phrase). So, say "Yes" to overwrite...
Now try to add the controller to your project and everything will be fine.
Good Luck!
I am working on an RCP application. Currently, I am stuck on trying to get the project created from my custom wizard to open the files in my CNF-based navigator. I am not really sure whether it needs to be done on the navigator-side or the wizard-side.
I came across a couple tutorials that put me on the right path. It turns out I needed a model for the project hierarchy and label/content providers.
http://cvalcarcel.wordpress.com/2009/07/11/writing-an-eclipse-plug-in-part-2-creating-a-custom-project-in-eclipse-adding-to-the-new-project-wizard/
http://cvalcarcel.wordpress.com/2009/07/26/writing-an-eclipse-plug-in-part-4-create-a-custom-project-in-eclipse-new-project-wizard-the-behavior/
http://cvalcarcel.wordpress.com/2009/10/18/writing-an-eclipse-plug-in-part-7-creating-a-custom-navigator/