Just trying out UaaS with a little test site before jumping in with a main client. I'd like to ask how people set their Visual Studio up. My sites usually have added code in either App_Code, classLib directories and Model and Controller directories. HQ seem to be telling me I need to have a two project set up, Web (for Umbraco) and Code (for the rest), which is fine, I can deal with that. But as I understand it, that means that the code in the "Code" project won't be committed to the UaaS GIT repo which kind of spoils a major UaaS selling point.
How to people handle this? Do you have 2 repos for the same solution, the UaaS one and another? Do you put just the "Code" project code in the non-UaaS repo? Does this cause issues with bringing on team members? It doesn't seem right at all so I'm assuming I've majorly misunderstood something somewhere along the line.
Great blog post, thanks. That has cleared quite a few things up :)
I was given the uaas.cmd file yesterday and used it to set up. It was very easy. This is just a trial so I'm replicating my own, very simple site to get to grips with everything. However, two issues....
1) I wasn't too sure about where to point my git client, so I pointed it at the one in myproject.Web and added a remote to my UaaS project git repo.
2) The site needs Archetype so I installed it and it's Courier extension via NuGet into myproject.Web. It took ages and appeared to download umbraco.core.7.2.2 and loads of other stuff. The site ran locally ok so I created a few docTypes and dataTypes and a couple of pages and then uploaded.
Things haven't been going well too well from then on. Attempting to view the project's back office in UaaS results in a YSOD :(
I've no doubt made an utter mess of it (because I'm good at that). What should I do with the GIT client side of things? Your blog seems to say the .git and .gitIgnore files in the myproject.web project are for the .Core code. I'm a bit confused about that. Shouldn't that be the UaaS git files and other ones be in the .Code project or have I got that wrong?
As for NuGet installs, should I have installed into the .Core project?
Just to note I updated the UaaS.cmd process while writing this to be ahead of some questions. So the additional git / gitignore stuff is new as of this afternoon.
Not sure what that means? In the .Web project, the remote already points to the UaaS project git repo :-)
Ah yes, well there's a good caveat and certainly something to improve for a future version of this script. Since the .Web project was not installed using NuGet, you can not install NuGet packages in it. This is the feedback we really want to get, great!
So for now the advise is: use "normal" Umbraco packages to install plugins into Umbraco. I'll see if I can do a proper NuGet install of the .Web project as well but I suspect that will be another few weeks of tinkering to get it right. ;)
So yes, now you've made a bit of a mess, not to worry if it's a trial project. It's nice that it's easy to start over (delete the site in the portal, create a new one, done).
Yes, I understand it's a bit of a bending of the mind to figure out the two repos:
YourName.Web contains a .git folder, which is your UaaS deployment git repository. Anything you add here and push to UaaS gets deployed to UaaS.
The folder above that ALSO contains a .git folder, which is where your custom code and VS files go. This one, you will need to share with your team using your own git server.
Note in the screenshot below that the paths point to the same folder and the .Web is just a subfolder in your code repo (it's in the gitignore so any changes you make in .Web don't appear in your custom code repo, that way they're isolated from each other but can still exist in the same folder to keep a nice overview).
Maybe that's something that needs to change to to make the mental model easier.
In general you can install nuget packages into both .core and .web. You should install into .core if you need to reference them from code in .core.
You should install into .web if the nuget package contains more than .dll.
Questions
Is the above understanding correct?
Do we still need to use uaas.cmd and create a .core project if we only install into .web?
Thanks
Jesper
ps. suggestion rename .core to .code - nothing core there :)
We look in your web.config and figure out what version of Umbraco you're using
We ask NuGet for the UmbracoCms package and to give us all the dependencies.
We go through all of the dependencies and see if they have dependencies, etc. etc.
When we know all of the dependencies, we make a de-duplicated list of them and put that list in a packages.config file and restore them in the packages folder where Visual Studio will look for them by default - this packages.config file gets copied into both Site.Core and Site.Web
We create the directory structure with a Site.Core and a Site.Web folder
We create a Visual Studio csproj file in the Site.Core directory, using your chosen namespace (this is just an xml file in which we replace some placeholders)
We create a Visual Studio Solution file in the root folder, which points to the Site.Core directory and sets it as a C# class project and it also points to the Site.Web directory and sets it as a Website Project (this is just a text file in which we replace some placeholders)
We do a git init in the root folder and add a .gitignore file in which Site.Web is ignored (Site.Web already is it's own git repository, the deploy repository for your UaaS site).
That's it! Now, because there is a packages.config file in the Site.Web folder, and that folder is now marked as being a Website Project in the sln file, you can install NuGet packages into the Website project.
This was a long way of saying: if you want to do this yourself in a manual way: create a VS solution with a Website project and drop in the packages.config file.
There's nothing secret going on here, and there's no limitations, that we know of, of using NuGet with UaaS sites.
And, as this is just a suggested setup, yes, you can change names, delete the C# class project, etc.
I've also updated the documentation with a note about it being a suggested setup, not a prescribed "you HAVE to do it this way" setup.
Does UaaS still need a separate GIT repo?
Just trying out UaaS with a little test site before jumping in with a main client. I'd like to ask how people set their Visual Studio up. My sites usually have added code in either App_Code, classLib directories and Model and Controller directories. HQ seem to be telling me I need to have a two project set up, Web (for Umbraco) and Code (for the rest), which is fine, I can deal with that. But as I understand it, that means that the code in the "Code" project won't be committed to the UaaS GIT repo which kind of spoils a major UaaS selling point.
How to people handle this? Do you have 2 repos for the same solution, the UaaS one and another? Do you put just the "Code" project code in the non-UaaS repo? Does this cause issues with bringing on team members? It doesn't seem right at all so I'm assuming I've majorly misunderstood something somewhere along the line.
Any advice appreciated. Thanks.
Craig
I started answering this, it turned out to be long, so I've written you a blog post instead! ;-)
https://cultiv.nl/blog/visual-studio-and-umbraco-as-a-service/
Great blog post, thanks. That has cleared quite a few things up :)
I was given the uaas.cmd file yesterday and used it to set up. It was very easy. This is just a trial so I'm replicating my own, very simple site to get to grips with everything. However, two issues....
1) I wasn't too sure about where to point my git client, so I pointed it at the one in myproject.Web and added a remote to my UaaS project git repo.
2) The site needs Archetype so I installed it and it's Courier extension via NuGet into myproject.Web. It took ages and appeared to download umbraco.core.7.2.2 and loads of other stuff. The site ran locally ok so I created a few docTypes and dataTypes and a couple of pages and then uploaded.
Things haven't been going well too well from then on. Attempting to view the project's back office in UaaS results in a YSOD :(
I've no doubt made an utter mess of it (because I'm good at that). What should I do with the GIT client side of things? Your blog seems to say the .git and .gitIgnore files in the myproject.web project are for the .Core code. I'm a bit confused about that. Shouldn't that be the UaaS git files and other ones be in the .Code project or have I got that wrong?
As for NuGet installs, should I have installed into the .Core project?
Thanks,
Craig
Just to note I updated the UaaS.cmd process while writing this to be ahead of some questions. So the additional git / gitignore stuff is new as of this afternoon.
.Web
project, the remote already points to the UaaS project git repo :-).Web
project was not installed using NuGet, you can not install NuGet packages in it. This is the feedback we really want to get, great!So for now the advise is: use "normal" Umbraco packages to install plugins into Umbraco. I'll see if I can do a proper NuGet install of the
.Web
project as well but I suspect that will be another few weeks of tinkering to get it right. ;)So yes, now you've made a bit of a mess, not to worry if it's a trial project. It's nice that it's easy to start over (delete the site in the portal, create a new one, done).
Yes, I understand it's a bit of a bending of the mind to figure out the two repos:
.git
folder, which is your UaaS deployment git repository. Anything you add here and push to UaaS gets deployed to UaaS..git
folder, which is where your custom code and VS files go. This one, you will need to share with your team using your own git server.Note in the screenshot below that the paths point to the same folder and the
.Web
is just a subfolder in your code repo (it's in the gitignore so any changes you make in.Web
don't appear in your custom code repo, that way they're isolated from each other but can still exist in the same folder to keep a nice overview). Maybe that's something that needs to change to to make the mental model easier.Hi Seb and craig
So I just cloned a project using uaas.cmd. Then I installed vorto into the .core project as suggested in 2)
It doesnt get copied to .web project. Whats the logic ?
How will that work - I mean some nuget packages might create a lot of files. Will this be transferred to .web?
Best
Jesper
Great answers Sebastiaan, thank you again.
My item 1) git issue happened because the script did all the downloading but I still needed to manually open the repo in SmartGit. Anyway, I know now.
Glad I can start from scratch again without having to trouble the "Help" guys at HQ.
Regarding the screenshots, I think it's fine as you have it.
Cheers,
Craig
What I understand from the twits of today with Sitereactor and Cultiv is the following:
Read these:
https://our.umbraco.org/documentation/Umbraco-as-a-Service/Set-Up/Visual-Studio/
https://our.umbraco.org/documentation/Umbraco-as-a-Service/Set-Up/Working-With-Visual-Studio/
So this seems to be my understanding
In general you can install nuget packages into both .core and .web. You should install into .core if you need to reference them from code in .core. You should install into .web if the nuget package contains more than .dll.
Questions
Thanks
Jesper
ps. suggestion rename .core to .code - nothing core there :)
I had no access to a laptop over the weekend so my tweets have been a bit short. Let me elaborate:
First of all: UaaS.cmd is just there to give the most people a Happy Path experience.
There's nothing proprietary about the setup and what it does:
git clone https://your-uaas-site.s1.umbraco.io
packages
folder where Visual Studio will look for them by default - this packages.config file gets copied into bothSite.Core
andSite.Web
Site.Core
and aSite.Web
foldercsproj
file in theSite.Core
directory, using your chosen namespace (this is just an xml file in which we replace some placeholders)Site.Core
directory and sets it as a C# class project and it also points to theSite.Web
directory and sets it as a Website Project (this is just a text file in which we replace some placeholders)git init
in the root folder and add a.gitignore
file in whichSite.Web
is ignored (Site.Web
already is it's own git repository, the deploy repository for your UaaS site).That's it! Now, because there is a packages.config file in the
Site.Web
folder, and that folder is now marked as being a Website Project in thesln
file, you can install NuGet packages into the Website project.This was a long way of saying: if you want to do this yourself in a manual way: create a VS solution with a Website project and drop in the packages.config file.
There's nothing secret going on here, and there's no limitations, that we know of, of using NuGet with UaaS sites.
And, as this is just a suggested setup, yes, you can change names, delete the C# class project, etc.
I've also updated the documentation with a note about it being a suggested setup, not a prescribed "you HAVE to do it this way" setup.
is working on a reply...