I have been playing around with Umbraco for a few days and I really like it. I'm a vb.net developer and I would like to set up my development environment in visual studio. The blogs I've found are all written for people who actually want to make changes to Umbraco code. I don't want to do that (yet). Right now, I just want to be able to open up the website in visual studio (2008 express), build website and run website. Are there any instructions for this? Also, is this the typical setup that developers use, or am I barking up the wrong tree? Ultimately I want to learn how to write a user control that accesses my sql server database and returns data to a page within umbraco. I have 2 machines: at work, windows xp and at home, windows 7/iis7. Any help would be greatly appreciated.
that sounds all quite reasonable. The VS Express version will get you going, and you can also try out your hands at developing custom .Net controls. If you don't want to build custom .Net controls etc right now you would actually not need any tool right now: you can just install Umbraco in a folder, set up a database, set up the web site and that should be it for you. I usually have a reference to the Umbraco web site as a project in my Visual Studio solution, it makes debugging a bit easier (I don't build the Umbraco web site though as I'm just referencing the already compiled version, there is no need to use the source as you have rightfully pointed out). If you develop your own .Net controls, web services, Xslt extensions etc. all you need to do is copy the respective files over to your local Umbraco install (e.g. the dlls, the aspx pages, etc), which can be made automatic via a nice post-build event in Visual Studio.
With regards to your setup: Windows XP has the limitation that you can only have one web site, and although there are ways around it it would be much better for your setup if both systems were the same. E.g. the configuration for .Net 2, 3.5. and 4 is different as well as the configuration for IIS6, 7 and 7.5. Not that you can't get it to work, yet why make your life harder than necessary?
Thank you for the quick reply. I am actually evaluating Umbraco for use at my client site. Since I know that I will need to develop user controls in the future, I want to try that out today. Let's talk about my XP machine at work, since this is where I'll mostly be developing. Last week I pulled down the latest Umbraco source code to D:\Sites\UmbracoTest. I mapped a virtual directory in iis 5.1. I then ran the install and the Runway module and watched a few videos, created some new pages. I am impressed with the product and things are going well. So now today I want to try creating a user control that retrieves data from my 'Customers' table.
1) As far as the database goes, I thought I would copy my Customers table right into the Umbraco database that I have in SQL Express - would that work?
2) How shall I set up my visual studio environment - should I use the D:\sites\Umbraco and open that as a web project, and add my own folders to it? Or are you saying that I should develop my user control outside of umbraco in another project and then copy the dll to the Umbraco bin folder? And in the 2nd scenario, how would I integrate my database access calls with the Umbraco framework? Perhaps I need to watch the user control videos first.
Again, thanks for any help. Once I set up a dev environment that I'm comfortable with, I think I can do a lot with Umbraco.
if I remember correctly then running an Umbraco site in a virtual directory causes some problems, yet it might be that they are already fixed. Shouldn't be a problem though since you are currently evaluating it. As to your questions:
1) Yes, that would work just fine and is how we usually do it. Obviously you can also create your own database and add a new connection string to the web.config file, yet that doesn't seem to be necessary.
2) I would definitely advise against merging your own code and the Umbraco web site in one project. It is much better and easier to separate them out if you think about maintenance and upgradeability (is that even a word?). Create a new project as web application (not web site), develop your own code in it (e.g. custom user controls, you will probably need to reference certain DLLs from the Umbraco web site like businesslogic.dll, cms.dll and umbraco.dll), build the project and then copy over your own DLLs to the bin folder, your ascx files to the /usercontrols folder of the Umbraco web site etc.
In order to access the Umbraco database (or better your own table in it) you can use the connection string in the Umbraco web.config file. You can then use the standard .Net database access methods to connect to the database. I think that will be highlighted in one of the videos.
Ok, Sascha, thanks for that info - I think that will get me going on the user control.
There is one more thing that I'm stuck on. I copied my CSS and MasterPage that I developed in Visual Studio, into my Umbraco Test site. In my MasterPage I have a .gif that is used for my banner across the top of the page - I call it TopBanner.gif. I went to Media and created it; however, I can't figure out how to refer to it in my MasterPage template. It's not as simple as <img src="topbanner.gif" alt="TopBanner"/>. Is there a video or another post detailing how to do this?
1) Directly reference the image from the media library. If you click on the thumbnail image in the media library a new window will open up with the full image displayed. You can get the url for that image from the navigation above. Cons: if someone replaces the image in the media library with another image that has not the same name your code will not be updated automatically. If somebody uploads a new banner (creates a new media item) and wants to reference that you would have to manually change the code in the template to reflect that change. That's not really what the content management system is for, these things should work automated! (Yet, if it is e.g. a logo that you know will only change once in a blue moon it might be alright to just hard code it.)
2) Make it dynamic. On the document type which is behind the template (or your top document type for the site) create a new property with the alias 'bannerImage' of type Media picker. On the content node for that document type you can now select the image you have created in the library. What is saved is actually the id of the media item. Now to display the item the easiest way would be to write a small Xslt script that will read out the id, get the url of the image from the media library and build up the <img> tag to display it.
For the last bit it's definitely worth checking out the videos, they are really great and probably the best source of information if you're starting out. Well worth going through them one by one and trying it out yourself on a local install.
you wrote in one of you posts above, that you refernece to the umbraco reference. Can you tell me how, i can create that reference? I'm googeling around all the time and cannot find out how to debug UserControls using VS Express edition (All the examples are using the attach to server mode, which is not possible in Express editions).
The way I have imported the Umbraco website into my Visual Studio solutions at that time (and it is still valid) is by adding an existing website to the solution. When you have your Visual Studio solution open (it can be empty or already contain other projects), go to File -> Add -> Existing website... You can then point to the directory where you have installed Umbraco. Next thing to do is in the solution properties (right click on the solution in solution explorer and select properties) to take the project out of the build process. As the Umbraco website is actually a web application it is already compiled so no need to do that again (and you will most likely encounter an error along the way anyway). Now if you just copy your compiled dlls and aspx files/etc from another project into the website you should be able to debug it. However I have to admit that I haven't worked with VS Express so far so there might be some issues there, yet my hopes are high that it will work. :)
Visual Studio Install for developers
Hi,
I have been playing around with Umbraco for a few days and I really like it. I'm a vb.net developer and I would like to set up my development environment in visual studio. The blogs I've found are all written for people who actually want to make changes to Umbraco code. I don't want to do that (yet). Right now, I just want to be able to open up the website in visual studio (2008 express), build website and run website. Are there any instructions for this? Also, is this the typical setup that developers use, or am I barking up the wrong tree? Ultimately I want to learn how to write a user control that accesses my sql server database and returns data to a page within umbraco. I have 2 machines: at work, windows xp and at home, windows 7/iis7. Any help would be greatly appreciated.
thank you!
Hi Candice,
that sounds all quite reasonable. The VS Express version will get you going, and you can also try out your hands at developing custom .Net controls. If you don't want to build custom .Net controls etc right now you would actually not need any tool right now: you can just install Umbraco in a folder, set up a database, set up the web site and that should be it for you. I usually have a reference to the Umbraco web site as a project in my Visual Studio solution, it makes debugging a bit easier (I don't build the Umbraco web site though as I'm just referencing the already compiled version, there is no need to use the source as you have rightfully pointed out). If you develop your own .Net controls, web services, Xslt extensions etc. all you need to do is copy the respective files over to your local Umbraco install (e.g. the dlls, the aspx pages, etc), which can be made automatic via a nice post-build event in Visual Studio.
With regards to your setup: Windows XP has the limitation that you can only have one web site, and although there are ways around it it would be much better for your setup if both systems were the same. E.g. the configuration for .Net 2, 3.5. and 4 is different as well as the configuration for IIS6, 7 and 7.5. Not that you can't get it to work, yet why make your life harder than necessary?
Hope that helps,
Sascha
Hi Sascha,
Thank you for the quick reply. I am actually evaluating Umbraco for use at my client site. Since I know that I will need to develop user controls in the future, I want to try that out today. Let's talk about my XP machine at work, since this is where I'll mostly be developing. Last week I pulled down the latest Umbraco source code to D:\Sites\UmbracoTest. I mapped a virtual directory in iis 5.1. I then ran the install and the Runway module and watched a few videos, created some new pages. I am impressed with the product and things are going well. So now today I want to try creating a user control that retrieves data from my 'Customers' table.
1) As far as the database goes, I thought I would copy my Customers table right into the Umbraco database that I have in SQL Express - would that work?
2) How shall I set up my visual studio environment - should I use the D:\sites\Umbraco and open that as a web project, and add my own folders to it? Or are you saying that I should develop my user control outside of umbraco in another project and then copy the dll to the Umbraco bin folder? And in the 2nd scenario, how would I integrate my database access calls with the Umbraco framework? Perhaps I need to watch the user control videos first.
Again, thanks for any help. Once I set up a dev environment that I'm comfortable with, I think I can do a lot with Umbraco.
Candice
Hi Candice,
if I remember correctly then running an Umbraco site in a virtual directory causes some problems, yet it might be that they are already fixed. Shouldn't be a problem though since you are currently evaluating it. As to your questions:
1) Yes, that would work just fine and is how we usually do it. Obviously you can also create your own database and add a new connection string to the web.config file, yet that doesn't seem to be necessary.
2) I would definitely advise against merging your own code and the Umbraco web site in one project. It is much better and easier to separate them out if you think about maintenance and upgradeability (is that even a word?). Create a new project as web application (not web site), develop your own code in it (e.g. custom user controls, you will probably need to reference certain DLLs from the Umbraco web site like businesslogic.dll, cms.dll and umbraco.dll), build the project and then copy over your own DLLs to the bin folder, your ascx files to the /usercontrols folder of the Umbraco web site etc.
In order to access the Umbraco database (or better your own table in it) you can use the connection string in the Umbraco web.config file. You can then use the standard .Net database access methods to connect to the database. I think that will be highlighted in one of the videos.
Cheers,
Sascha
Ok, Sascha, thanks for that info - I think that will get me going on the user control.
There is one more thing that I'm stuck on. I copied my CSS and MasterPage that I developed in Visual Studio, into my Umbraco Test site. In my MasterPage I have a .gif that is used for my banner across the top of the page - I call it TopBanner.gif. I went to Media and created it; however, I can't figure out how to refer to it in my MasterPage template. It's not as simple as <img src="topbanner.gif" alt="TopBanner"/>. Is there a video or another post detailing how to do this?
thanks.
Candice
You can basically do two things here:
1) Directly reference the image from the media library. If you click on the thumbnail image in the media library a new window will open up with the full image displayed. You can get the url for that image from the navigation above. Cons: if someone replaces the image in the media library with another image that has not the same name your code will not be updated automatically. If somebody uploads a new banner (creates a new media item) and wants to reference that you would have to manually change the code in the template to reflect that change. That's not really what the content management system is for, these things should work automated! (Yet, if it is e.g. a logo that you know will only change once in a blue moon it might be alright to just hard code it.)
2) Make it dynamic. On the document type which is behind the template (or your top document type for the site) create a new property with the alias 'bannerImage' of type Media picker. On the content node for that document type you can now select the image you have created in the library. What is saved is actually the id of the media item. Now to display the item the easiest way would be to write a small Xslt script that will read out the id, get the url of the image from the media library and build up the <img> tag to display it.
For the last bit it's definitely worth checking out the videos, they are really great and probably the best source of information if you're starting out. Well worth going through them one by one and trying it out yourself on a local install.
Cheers,
Sascha
Thanks again Sascha for your help today. I'll give these things a try!
Hi Sasha,
you wrote in one of you posts above, that you refernece to the umbraco reference. Can you tell me how, i can create that reference? I'm googeling around all the time and cannot find out how to debug UserControls using VS Express edition (All the examples are using the attach to server mode, which is not possible in Express editions).
Thank you in advance,
Michael
Hi Michael,
The way I have imported the Umbraco website into my Visual Studio solutions at that time (and it is still valid) is by adding an existing website to the solution. When you have your Visual Studio solution open (it can be empty or already contain other projects), go to File -> Add -> Existing website... You can then point to the directory where you have installed Umbraco. Next thing to do is in the solution properties (right click on the solution in solution explorer and select properties) to take the project out of the build process. As the Umbraco website is actually a web application it is already compiled so no need to do that again (and you will most likely encounter an error along the way anyway). Now if you just copy your compiled dlls and aspx files/etc from another project into the website you should be able to debug it. However I have to admit that I haven't worked with VS Express so far so there might be some issues there, yet my hopes are high that it will work. :)
Hope that helps,
Sascha
Hi,
thanks for your fast reply! Its working fine now. Than you very much,
R Michael
Exellent, glad you could make it work! :)
is working on a reply...