I wonder if anyone can clarify the below. I am new to Umbraco.
I am working in Umbraco cloud and following the "Create Simple Login Functionality" video. It asks to create a LoginController.cs which appears to live in the Controllers folder.
Do I need to create these when using Umbraco cloud or is there something I have not found in the backoffice?
I have downloaded the web site locally but do not have a Controllers folder.
If I do have to create a controller do I just create a folder and then add the LoginController.cs and upload via Git?
if you are using Windows/Visual Studio and follow the guide for working with Cloud and Visual Studio there are a few differences compared to a "standard" install. Mainly that you should add your custom code (such as controllers, models, event handlers etc.) in the .Core project. When you build the solution this will be compiled in to the .Web project. This approach can only be used on windows and with Visual Studio (not Visual Studio Code) because you need to run IIS-Express (server) and ASP.Net (framework) and these are ONLY available on windows.
If you're using the uaas-cli to develop on in macOS, things get a little bit more tricky. You can add custom C# code by creating your classes in the /App_Code/ folder (You can organize with subfolders such as /App_Code/Models/). These files will be compiled at runtime but that means the files will need to be pushed to the server before you can test.
The uaas-cli is great for working with frontend, HTML, CSS, JS, Razor, templates and all that but it can't really accommodate more heavy duty programming. (I've only used it for frontend stuff, so happy to be proven wrong if someone else has a different experience).
So, if you want to work with C# that needs to be compiled it's either the /App_Code/ folder or the .Core project.
Have you seen this tutorial on umbraco.tv? It's really got for getting your head around how it works.
Hope that helps
All the best Rune
PS.: The approach with a class library (the .Core project) is a very common pattern, also on non-cloud projects :)
We are still evaluating Umbraco and which platform to develop our sites on. We will always be using Umbraco cloud. For a non programmer Umbraco is very technical, we are used to just uploading amended files using FTP.
Would you recommend working on a windows PC or still persevere with the Mac environment?
If we continue on with the mac environment. Have I set up the file structure correctly?
If it is correct do i just push this using Gitkraken to publish on Umbraco?
Yes, that is the correct structure. I would recommend going with Windows and Visual Studio 2017. You get so much more help when developing, debugging and you can run the project locally without having to connect to the development database.
Surface controllers in Umbraco cloud
I wonder if anyone can clarify the below. I am new to Umbraco.
I am working in Umbraco cloud and following the "Create Simple Login Functionality" video. It asks to create a LoginController.cs which appears to live in the Controllers folder.
Do I need to create these when using Umbraco cloud or is there something I have not found in the backoffice?
I have downloaded the web site locally but do not have a Controllers folder.
If I do have to create a controller do I just create a folder and then add the LoginController.cs and upload via Git?
Create a visual studio solution - https://our.umbraco.com/documentation/Umbraco-Cloud/Set-Up/Visual-Studio/
It will all make sense after that.
The websites on umbraco cloud should not contain un-compiled code. Reading the docs should answer a lot of the how/why : https://our.umbraco.com/documentation/Umbraco-Cloud/
Thanks Soren
I have done this a few times and I do not get anything like the doumentation. I am working on a mac and using visual studio for mac.
Hi Mark
It will not work since Visual Studio for the mac only works with .NET core based projects and Umbraco is not running on .NET core yet. See https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2017-compatibility-mac
Also see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/choose-aspnet-framework?view=aspnetcore-2.1 where it's mentioned that ASP.NET is windows only and ASP.NET Core is available on Windows, Linux and MacOS.
There is also a note in the documentation here https://our.umbraco.com/documentation/Getting-Started/Setup/Requirements/ where it says that Umbraco will not run ASP.NET core.
So unless you install windows on a virtual machine and run visual studio on that then you won't be able to do this unfortunately. See the documentation about it here https://our.umbraco.com/documentation/Getting-Started/Setup/Install/running-umbraco-on-a-mac
I hope this clarifies things :)
/Jan
Hi Mark,
if you are using Windows/Visual Studio and follow the guide for working with Cloud and Visual Studio there are a few differences compared to a "standard" install. Mainly that you should add your custom code (such as controllers, models, event handlers etc.) in the .Core project. When you build the solution this will be compiled in to the .Web project. This approach can only be used on windows and with Visual Studio (not Visual Studio Code) because you need to run IIS-Express (server) and ASP.Net (framework) and these are ONLY available on windows.
If you're using the uaas-cli to develop on in macOS, things get a little bit more tricky. You can add custom C# code by creating your classes in the
/App_Code/
folder (You can organize with subfolders such as/App_Code/Models/
). These files will be compiled at runtime but that means the files will need to be pushed to the server before you can test.The uaas-cli is great for working with frontend, HTML, CSS, JS, Razor, templates and all that but it can't really accommodate more heavy duty programming. (I've only used it for frontend stuff, so happy to be proven wrong if someone else has a different experience).
So, if you want to work with C# that needs to be compiled it's either the
/App_Code/
folder or the .Core project.Have you seen this tutorial on umbraco.tv? It's really got for getting your head around how it works.
Hope that helps
All the best
Rune
PS.: The approach with a class library (the .Core project) is a very common pattern, also on non-cloud projects :)
Ah yes, the
/App_Code/
approach...totally forgot about that. That's of course an option too! :)/Jan
Yup but still tricky if using uaas-cli I think. Great if you're working with VS Code and IIS Express 🤘
Thanks for your comments.
We are still evaluating Umbraco and which platform to develop our sites on. We will always be using Umbraco cloud. For a non programmer Umbraco is very technical, we are used to just uploading amended files using FTP.
Would you recommend working on a windows PC or still persevere with the Mac environment?
If we continue on with the mac environment. Have I set up the file structure correctly?
If it is correct do i just push this using Gitkraken to publish on Umbraco?
Hi Mark,
Yes, that is the correct structure. I would recommend going with Windows and Visual Studio 2017. You get so much more help when developing, debugging and you can run the project locally without having to connect to the development database.
/Rune
is working on a reply...