I know there are lots of articles explaining how to configure Visual Studio to work with Umbraco, but to be honest I'm completely confused how this is meant to work.
I dont want to write any controls, just add some functionaility to some of the Master Pages that I have within Umbraco. I need to be able to start my website through Visual studio so that I can set breaks points to see whats going wrong...
Currently I'm developing this locally so I've opened the site with visual studio (umbraco folder and all), when I launch the site I keep getting build errors, I've tried added the required references - but still no joy...
Please........ someone guide me in the right direction.......
I'm not sure if this is how things should be done, but it works for me and since theres no better answer yet, this is better than nothing! ;)
The way I have things set up is as follows (quite a lengthy guide, but its easy once you get the hang of it):
Create a new blank solution for my entire website: C:\Source\MyNewWebsite\
Right click the solution and 'Add New Web Site' - choose 'ASP.NET Empty Web Site'. I usually rename the path to something like this (C:\Source\MyNewWebsite\Website)
The next thing you need to do is right click the Web Project - select Property Pages.
In the 'Start Action' dropdown, select 'Build Page' - this ensures that the whole web project will not be built, which is what is causing you trouble.
Also while in here - remove the checkmark from 'Build Web site as part of solution', to ensure it won't try to build if you select build solution.
One last thing to configure is the path (and port) of the dev webserver. Click the Website project and go to the properties pane in VS. Virtual Path should be set to: / If you want to use a specific port to host the website, deselect 'Use dynamic ports' and set the port number manually. (This might come in handy if you code some webservices hosted in Umbraco, so you are sure which port the site can be reached at, at any time)
What you would do next is download the newest stable Umbraco release from codeplex and unzip the contents into your \Website\ folder Path to masterpages folder should be 'C:\Source\MyNewWebsite\Website\masterpages', if you did it correct ;)
Now this is just info for others since you said you didn't really need this! - if you need to have some custom handlers, you would create a new class library project next to the website project, add the handlers here, create a build action for that project that copies the .dll file into the \bin\ folder of your website and you're good to go.
What I do next, is right click the web project and select 'View in browser'. I prefer to only use debugging when I really need to, as it slows down a bit.
From here you just install Umbraco as you would usually do (remember to create a database on your SQL server) and go nuts :)
A few tips:
Masterpages needs to be created from inside Umbraco, to have them show up in the CMS. However, masterpages created from Umbraco does not have the 2-file-split (.aspx / .aspx.cs) which I find rather annoying. To work around this, I usually go in VS, create a new masterpage and leave it open. Then I go to Umbraco and create a new masterpage with the same name and save it. Umbraco will then overwrite your masterpage. When done, go back in VS and you will be noticed that the file has been changed outside your environment and it asks you to reload. Instead of reloading, press 'No' and save YOUR masterpage again, overwriting what Umbraco just wrote and you will have the two file split, AND the masterpage registred in the CMS! :)
Custom classes you create should reside in \App_Code\ - it will suggest you to move it there if you try to place it elsewhere.
UserControls should be put in \usercontrols\ and can then be added to Umbraco by adding a new Macro from the developer section. Public properties exposed on a usercontrol can be added as parameters to be set on the Macro when adding it in the CMS.
Hope this will help you - and maybe some others on the way.
If anyone who knows more about this wants to correct me on anything - please do so. It's always nice to learn new stuff and I'm in no way sure I am doing this the right way ;)
The site i'm currently working on I've managed to get umbraco to work through VS by excluding some webservices and building umbraco.webservices.dll from the source. But next time a build an umbraco site i'm definately going to use your walk-through!!!!
Because Umbraco has been pre-compiled, it is not necessary to build the project, you will actually get quite a few errors if you try to. If you often find yourself hitting F5 in Visual Studio to launch your website, the tips provided by Claus to avoid building the project, comes in quite handy.
And Claus, really nice explanation of the master-page issue :)
It creates everything for you, and separates the Umbraco site itself from your own development. Copy of the necessary files is done with postbuild events (which can be edited to your needs), and debugging can be achieved by attaching your project to the web service running the umbraco site (aspnet_wp, or w3wp etc.)
Running a umbraco website through Visual Studio
I know there are lots of articles explaining how to configure Visual Studio to work with Umbraco, but to be honest I'm completely confused how this is meant to work.
I dont want to write any controls, just add some functionaility to some of the Master Pages that I have within Umbraco. I need to be able to start my website through Visual studio so that I can set breaks points to see whats going wrong...
Currently I'm developing this locally so I've opened the site with visual studio (umbraco folder and all), when I launch the site I keep getting build errors, I've tried added the required references - but still no joy...
Please........ someone guide me in the right direction.......
THANKS
Hi there,
I'm not sure if this is how things should be done, but it works for me and since theres no better answer yet, this is better than nothing! ;)
The way I have things set up is as follows (quite a lengthy guide, but its easy once you get the hang of it):
C:\Source\MyNewWebsite\
I usually rename the path to something like this (C:\Source\MyNewWebsite\Website)
Virtual Path should be set to: /
If you want to use a specific port to host the website, deselect 'Use dynamic ports' and set the port number manually.
(This might come in handy if you code some webservices hosted in Umbraco, so you are sure which port the site can be reached at, at any time)
Path to masterpages folder should be 'C:\Source\MyNewWebsite\Website\masterpages', if you did it correct ;)
What I do next, is right click the web project and select 'View in browser'. I prefer to only use debugging when I really need to, as it slows down a bit.
From here you just install Umbraco as you would usually do (remember to create a database on your SQL server) and go nuts :)
A few tips:
Hope this will help you - and maybe some others on the way.
If anyone who knows more about this wants to correct me on anything - please do so. It's always nice to learn new stuff and I'm in no way sure I am doing this the right way ;)
-Claus
(edited - formatting was broken)
Thanks so much for the excellent explanation!
The site i'm currently working on I've managed to get umbraco to work through VS by excluding some webservices and building umbraco.webservices.dll from the source. But next time a build an umbraco site i'm definately going to use your walk-through!!!!
Thanks really apprechiated!
Michael
No problem - you're probably not the only one wondering how to do this. Glad to help you out ;)
-Claus
I had no idea this was possible!
Thanks for the detailed info..
Because Umbraco has been pre-compiled, it is not necessary to build the project, you will actually get quite a few errors if you try to.
If you often find yourself hitting F5 in Visual Studio to launch your website, the tips provided by Claus to avoid building the project, comes in quite handy.
And Claus, really nice explanation of the master-page issue :)
Hello,
Just for information, an alternative solution might be the Visuale Studio 2010 project template which can be found here : http://our.umbraco.org/projects/developer-tools/visual-studio-2010-project-template-.
It creates everything for you, and separates the Umbraco site itself from your own development. Copy of the necessary files is done with postbuild events (which can be edited to your needs), and debugging can be achieved by attaching your project to the web service running the umbraco site (aspnet_wp, or w3wp etc.)
Cheers,
Michael.
Hmmm that looks pretty neat - I think I'll take a look at it when I get a little spare time ;)
Thanks Mike!
is working on a reply...