How can I route my solution into different projects? - asp.net-mvc

I'm looking for a solution to be able to store my websites in individual projects, while keeping one project as an entrypoint that can route into those projects.
The ideal setup would be something like the following:
- Main (entrypoint)
- Website1
- Website2
- Website3
I need this format to allow someone to access their website (ie. Website1) as a solution they can run and debug on their own, without having access to the entire application.
Basically, I want to be able to set up a new project, add the reference to the Main project, add an entry into my routes, and allow the new project to be built out and tested if it needs to be.
Is this possible?
I've looked at using areas and tried several plugins, but I can't seem to get this working properly. My biggest issue right now isn't routing into the project's controller, as I can get into that action perfectly, but once there, I can't reference any of the ASPX files properly. (I need to be able to reference them within the context of the project and the entire solution.)
If anyone could direct me towards other resources or questions I might have missed, I'd appreciate that as well. Thank you!

You should be able to doe this using a source control program of your choice. Put each website project in a separate folder and reference each website project file to a main master.sln file in a different folder called MasterSolution. Commit it all to source control. Then, for a user that opens Website one only, they just do open project, and go to the Website1 project folder and open the project file for Website1. Your MasterSolution is not opened but always gets the latest code as after the Website1 developer does a commit of his/her Website1 updates.

Related

Intellisense namespace discovery in Visual Studio not working after moving files to another project

I started with a single ASP.Net MVC project named Yogabandy2017 that had a folder called viewmodels. I stored all the viewmodels in it.
I moved all the files from that folder to another project called Yogabandy2017.Models where I stored all my models and I created a folder in it called Viewmodels where I put all the viewmodels, I also changed the namespacing in each of the viewmodels to match.
Then I did a large copy and 'replace all' in each view so that each view can now point to the correct folder like this
from this
to this, where I added the .Models to make the path correct
But intellisense still hasn't changed and picked up the correct path. I've tried to clean the solution, rebiuild it a couple of times. and still the path isn't connecting correctly. I still have the red underline and an exception being thrown when traversing the page saying it can't find the path.
Is there any way to get these paths to reset without going to each file and rewritting them manually? I have a few hundred and going through each one by one to make the change will take forever.
Any help would be appreciated...
Check your cases...
YogaBandy2017
vs.
Yogabandy2017

Why can't I view or edit Umbraco templates?

When I open the Umbraco (7.6.3) backoffice, I'm unable to view or make changes to templates. It seems like other functionality is unaffected, and I can create & edit specific pages. However, attempting to open the templates themselves just leads to a white screen. This problem exists across browsers:
Other screens render just fine:
What gives?
Checking the console when attempting to load gives an interesting error:
Error: Argument 'Umbraco.Editors.Templates.EditController' is not a function, got undefined...
Resolution:
The issue seemed to be caused by outdated files in the Umbraco folder. Copying most directories over from packages\UmbracoCms.7.6.3\UmbracoFiles\umbraco\ seems to have done the trick.
Looking at the changelog, it seems like the JS folder was the most influential in getting this fixed.
Are you sure that you're on 7.6.3? The UI appears to be pre-7.6 (I can tell because the colours haven't been updated).
If you have just upgraded, it's possible that your browser has cached the JS which is used - hard refresh your browser to see if the UI updates.
Umbraco also uses a dependency service to compile all of the used JS/CSS files together into one large one. This service will not be used if your website is in debug mode. Either:
Turn debug mode on in the Web.config
Delete any files in the \App_Data\ClientDependency\ folder as this is where the cached compiled files are kept (these will be regenerated)
My first thought would be file permissions.
Have you run the health check for permissions in the developer section? Need to make sure that your application pool user has write permissions on the Views folder.

Merge an existing MVC application with a new one

I am developing an MVC4 public facing website which should have a blog, I didn't want to develop one from scratch so I got a nice open source one from codeplex.
Herein lies the problem: I have to integrate this into the site I am building, I can't have a random link sending the user off to a separate blog site as I have to display sections from the blog on my original site.
I thought about using Areas which I will give a go after posting this but I was interested in knowing if there is a better way to do this or caveats that i need to be aware of etc.
Thanls for all the help :)
So I managed to do this with a bit of tinkering.
First I added the source code projects to my solution. Then I created an area called Blog and deleted all of the boilerplate stuff except BlogAreaRegistration.cs. I then looked at the References and referenced all corresponding libraries as well as the accompanying class library projects.
I copied all the folders except App_Data, Content and Scripts into Areas/Blog. Copied the previously mentioned folders to their respective locations in the root website.
I then compared both Global.asax's and web.configs, copied across the missing sections into my own files (not without the help of Examdiff for the configs).
I then had to copy the default ViewTemplates from the Areas/Blog/Views directory to the root Views Folder.
...press F5 and voila!
Ofcourse I make it sound like a disney fairytale bbut it was alot more difficult with lots of trial and error (of a yellow screen of death kind).
Well, that's my 2 cents just incase anyone else runs into the same murky waters in the future

Absolute path for img and js excluding project folder name Visual Web Dev

I've this little but annoying issue in my project in Visual Web Developer 2010 Express. I'm developing a website with .aspx files located in a large folder structure i.e. www.domain.com/group1/type1/somefile.aspx, the root folder contains a "styles" (for css), "images" and "js" (for javascripts) folder. I've read a lot about base tag, absolute and relative path today. Finally I realized "absolute path" is the best choice for me.
The main problem is that when I preview (locally) my site in browser the absolute links for image, css, and js are not working, I'm using src="/js/gl.jquery.js" which I believe is correct and will work online.
The source code of the page for the javascript says http://localhost:61700/js/gl.jquery.js, when I switch to relative path script src="../../../js/gl.jquery.js" and preview the website, it works fine, and the source code for the javascript path says http://localhost:61700/ProjectName/js/gl.jquery.js (Notice Visual Studio added the ProjectName in the path) So I'm taking my guess that when the project goes online (on a main domain) it will work correctly, but right now I need to keep developing locally without this issue. Is there a way to fix this in Visual Web Developer? maybe some tag for the web.config file that I can remove when goes online, or some website property?
I know a quick solution will be develop with the relative path, and modify the code when goes online to absolute path, but I'm looking for some cleaner method, as aditional information I didn't choose base tag because I read cause troubles with anchors links (href=xx.html#question3) and I need to use them at some big files. And avoid the relative path because it's possible that the company ask me to move some files in the future and I don't wanna be updating relative paths.
Thanks a Lot!
Problem solved! This is the solution I found Thanks to ScottGu's Blog.
I quote the main thing:
when opened a web-site and run the project, VWD launch and run the built-in web-server using a virtual app path that equals the project’s root directory name. For example: if you have a project named “Foo”, it will launch and run in the built-in web-server as http://localhost:1234/Foo/Default.aspx.
One downside to this is that it makes it hard to fully qualify things like static CSS and image files within your site (for example: using root qualified paths like /images/myphoto.jpg or /css/mycss.css). Note that you can use the “~” app path trick for dynamic resources – but static resources still end up being a pain (js, css, images files.) (This was my issue)
Here is the guy entire post: Click Here
Here is the main solution:
1) Using the solution explorer within Visual Studio, select the web-site project node, (the one with the World icon)
2) There is a properties named "Virtual path" at the bottom. Change the "virtual path" setting it to / to run as a root web-site.
And that's it, setting up the / I can manage my files easily.

Asp.net MVC, adding edmx gives trusted zone warning

I have an ASP.net MVC 4 project I am working on and am trying to add an ADO.net EF model to it using Database First.
The creation of the model (.edmx file) seems to run successfully and I am left with the desired .edmx model file in the folder I specified. However, I don't appear to be able to see any of the files nested under this model. (From all my research, I should be able to expand the .edmx file and see *Context.vb, *Designer.vb, *.edmx.diagram and *.tt files underneath, but I cannot.)
It should look something like this in the msdn article about Database First (see Step 4):
Upon noticing this issue, I discovered a handful of warnings that appeared after creating the .edmx model, one of which is (I have obscured part of the full path):
The path 'P:\IT\...\DAL\EF.Utility.VB.ttinclude' must be either local to this computer or part of your trusted zone. If you have downloaded this template, you may need to 'Unblock' it using the properties page for the template file in File Explorer.
The project is stored on a network share on one of our servers so it can be included in our daily backups and Windows Shadow copy also. My understanding is that the above warning has appeared because of this and I need to set my machine to trust this location.
I have tried all possible variations I can think of of
this MSDN article
but to absolutely not success at all, the warning remains.
Either I am looking in the wrong place, or I have missed something.
Does anyone know what I can do to remove this warning and gain access to the objects nested below the .edmx model?
Perhaps this could be of some assistance. I've never really dealt with trust issues working across the domain. I lean towards pulling down and working with a local copy.

Resources