Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • wdr1986 2 posts 72 karma points
    Apr 27, 2020 @ 15:13
    wdr1986
    0

    How to make changes in the backoffice using Visual Studio?

    Hello, I am new to Umbraco and I have just builded my Visual Studio solution used UaaS.cmd using this chapter of the documentation - https://our.umbraco.com/documentation/Umbraco-Cloud/set-up/Working-With-Visual-Studio/.

    I am working locally and when I push changes using git command, my live environment is also updated.

    The thing is, it works fine when I change content of the website, but it doesn't work that fine when I try to make changes in the backoffice. Let me give you an example.

    I am changing the content of home.cshtml file under MyUmbracoNamespace.Web/Views by adding "<.h2>TEST SENTENCE<./h2>" (have to add dots, so HTML editor doesn't apply this to my message). I am running website by pressing F5 in the Visual Studio and I can see that changes have been made. I am using git commands to push this change to the live environment (git add Views/home.cshtml and git push origin master). After a while I can see changes are working there too. See image below enter image description here

    Now things will look a little bit weird. I want to make changes in the Umbraco backoffice, for example to change names of some menu items and so on. Let's say I want to change macro name from "Get Latest Blogposts" to something else. I am searching for this name in my solution and I am finding .uda file that contains following

    "Name": "Get Latest Blogposts",
    

    So I am changing value to "Get Latest Blogposts 123" (just to see if change will apply). I am repeating steps I did while updating home.cshtml and looking for changes. It turns out that it hasn't been applied to my local environment, but it has been applied to my live environment.

    Then I am trying to change message that is displayed when I create macro. It says "Enter macro name". I am searching for this phrase in my solution and find it under MyUmbracoNamespace.Web/umbraco/Config/Lang/en.xml and en_us.xml. I am changing its value to "Enter macro name 123" and repeating steps I did while updating home.cshtml. This time change has been applied to my local environment, but hasn't to my live environment.

    Why is that? How can I make changes that will be applied to both environments?

    Below image shows differences between my local environment and live environment (changing message worked only in local environment and changing macro name worked only in live environment).

    enter image description here

  • Paul 6 posts 75 karma points
    Apr 28, 2020 @ 00:26
    Paul
    0

    I'm not sure if I'm following fully....but I think you might be getting two different things slight confused.

    First: There is Razor code in the .cshtml page. When you change it, when the page renders it uses that logic. So the page immediately renders different it per the Razor logic. You can modify the .cshtml code via VS/Code/Backoffice.

    Second: There is 'Content'. You can only change it via Backoffice. BUUUUUTTTT......it is versioned in the database. So you have to publish it before the site will use the new version. The .uda files are generated with you change content....so I have a hunch you didn't get the logic you want changed published. In the 'Content' tree, you'll notice unpublished items are lighter when there is an unpublished change.

    Hope this helps.

  • wdr1986 2 posts 72 karma points
    Apr 28, 2020 @ 10:08
    wdr1986
    0

    Hello Paul,

    You were right that Content is stored in the database. Under MyUmbracoNamespace.Web/App_Data I have found Umbraco.mdf. I was able to open it in SQL Server Object Explorer, then open some table and change data there. Although changing it caused a lot of issues (looks like there is some limit of updating the data in the database, because at the beginning I was able to change some value and it worked, but then I was receiving many errors, starting from "connection has been broken" to "Umbraco.mdf file is blocked by another process"), this doesn't really matter for now as in theory it worked.

    But my second question remained unanswered. How to apply changes made in XML files to live environment? I made changes in these files and it works fine in local environment just after refreshing the page, but live environment doesn't seem to get these changes even after pushing them by git.

  • Paul 6 posts 75 karma points
    Apr 28, 2020 @ 13:29
    Paul
    0

    Absolutely correct -- the content is stored in the database. Multiple versions of the content actually. You probably only changed the currently published data....so you can't take advantage of the rollback to get back to the content you had just before you edited the database.

    In short, you're fighting to drag Umbraco in the opposite different direction than it was designed for.

    I would suggest you edit the content via the back office and then publish the content. The XML data in the english configuration -- I believe it is being treated as content. So.....use the publish approach! Hands off the database! ;)

Please Sign in or register to post replies

Write your reply to:

Draft