Configure the multimedia components to get published inside the website folder - components

Need to publish the JS and CSS files using multimedia components.
The multimedia components gets published outside the website folder similar to the Images in
“C:\tridion\temp\pub14\Includes\scripts”
Any Idea How to Configure the multimedia components to get published inside the website folder.
We are using IIS to deploy website

You can control this by editing cd_storage_conf.xml. In this file you can configure where binaries go for each publication. For example: you probably have something like this configured: <Item typeMapping="Binary" cached="false" storageId="myStorageId"/> and this myStorageId storage is defined inside the Storages element like:
<Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory"
Id="myStorageId" defaultFilesystem="true" defaultStorage="true">
<Root Path="c:\temp\" />
</Storage>
If that is the case then you need to change the root path to point to the root of your WebApplication in IIS. More about how to configure the storage you have here (logon required).

You can overide the path of your multimedia binary using template code as long as you have structure group created for same path.
Ex if you want to publish particular binary to \css\images folder, you first have to create the structure group for same path(\css\images) and use the structure group id in the following code to publish the binary.
engine.AddBinary(Binary.Id, templateID, binaryStructureGroupID, Binary.BinaryContent.GetByteArray(), Binary.FileName);

Related

How to make Azure App Service Web Apps serve my website out of my repoRoot/src/views/ folder as the website root?

In one of my git repos, I've got a simple HTML website with the following folder structure:
repo root:
--reference
--developer-notes.txt
--i-am-not-website-code.txt
--i-am-not-meant-to-be-served-by-web-server.txt
--etc.txt
--src
--views
--index.html
--etc.html
--content
--foo.css
--etc.css
--images
--foo.png
--etc.png
--scripts
--foo.js
--etc.js
I just created a App Service Web App on Azure, configured it to pull the source out of my repo, and deployed it.
I made sure that the Application Settings -> Default Document list had an entry for the index.html file.
However, as understood, due to my folder structure, I can only view my website if I go to:
foo.azurewebsites.net/src/views/index.html
I cannot go just to:
foo.azurewebsites.net/
and see my index.html page.
Now, I can change my folder structure by putting my HTML pages in the root, to make the website appear at foo.azurewebsites.net/. But I was wondering if there was a way to not have to do that, esp. given that every repo also stores stuff other than the source code, for example in my case the Reference folder, and most repos have the source, which only one of the many artifacts, in the source folder.
Is there?
One thing you can do is to change the virtual path for your root application to point to your views folder in the Virtual applications and directories section of your Application settings. That way you will have foo.azurewebsites.net/ serve your index.html file.
Another thing you will have to do in this case, is to set the virtual application paths for your content and scripts folders (and the reference folder if you need to access it's content from the web) since they are not under your views folder.
Given your folder structure, it would look something like this:

Kentico v7 - Disable 'GetAzureFile' Permanent url

I'm working in a site on Kentico v7 but i have a problem with the images that were stored in media folder; because i was trying to get on CMS the direct URL link of the image in the folder, but the link that CMS displayed is using the page "GetAzureFile.aspx" to get the image; I was validated in SiteManager -> Content -> Media -> General that the option "Use Permanent URL" is disabled but the problem appeared again.
Any insights would be greatly appreciated!
The Azure projects always use blob storage to store newly uploaded files. This is because technically the only files available physically in file system are the ones that were deployed with the project, and when any Azure instance restarts, it looses its local file system and only deployment package is restored on new instances.
As media library content may change on-the-fly, Kentico uses GetAzureFile links for all files to be able to serve them regardless of their storage.
You can however use hardcoded links directly to file system to the files that were part of the deployment package, e.g. ones that you use for site design.

Azure project - which subfolders/files should be checked into version control?

I am working on a small Azure project (using Visual Studio 2015). I have created a Azure Cloud service project with only one webjob. Inside the cloud service project, vs2015 created some subfolders like 'csx', 'ecf', 'XXXXXXXXContent', 'Profile', 'rcf'.
I wonder whether I should checkin these subfolders and the files inside. Of course, the 'Release' and 'Debug' folder inside these subfolders won't be checked in.
Folders with lowercases are generated during compilation and publish process.
csx: Packaged files which ready to be published. But as of Azure Tools v1.4, it is no longer generated unless you run in emulator. This blog post describes in detail.
rcf: which stands for Role Content Files. You already has ---WorkerRoleContent and rcf is generated through build configuration. You can think it as a kind of bin folder for contents.
ecf: It is generated folder for diagnostics settings depended on `diagnostics.wadcfgx' file. The file is specific for publish settings, so you should not include it in source control.
Overall, all three folders are automatically generated for publishing and they should not be added to source control.
However, Profile and ----Content folders are required to maintain your publish settings.

Include referenced assembly's configuration in cspkg

I have an executable that I want to be deployed together with my Azure web role. The executable has a configuration file that needs to be included as well.
I tried adding a reference to the executable's project in my web role project, which made the exe file appear in the bin folder of the cspkg, but not the configuration file.
How can I get the configuration file to be included as well?
It seems wrong to include it directly as a content file in the web role project because this file is a build artifact (app.config gets renamed to .config.exe during build).
Thanks!
In an early SDK they added the concept of Role Content folders, or folders you could point to in the service definition file and say anything in this folder, add it to the package and deploy it with the role. If you look at the schema for the Service Definition you'll see these listed on the both the web and worker roles schemas. You can manually add this and point to any location on the local system and anything in that directory will be picked up and included.
<WebRole name="SimpleWeb" vmsize="Small">
...
<Contents>
<Content destination="ConsoleApp">
<SourceDirectory path="c:\src\SimpleWebContent\ConsoleApp\BuildOutput" />
</Content>
</Contents>
</WebRole>
For example, you could point to the output directory of the build for your executable so that anything that is generated by your build for that executable would be included. You can set the destination directory in relation to the app root, but the tricky part is the source directory. Note in my example above the full path is provided. The documentation says that you can use a relative path, but I tried many combinations and the behavior seemed very quirky. The complete path does work.
The VS SDK tools didn't expose this until SDK 1.7 and it's still not very good. Phil Hoff did a blog post on it called "Add Files to your Windows Azure Package using Role Content Folders". Note that when you use this method of adding the files you won't see the content elements appear in your service definition. They get auto injected at package time. If you are doing this as part of a build process that may not happen since VS tooling is doing the injection, but to be fair I didn't try calling cspack directly to see if having the content elements included in the service definition file actually packaged those or not. Also, I found that just adding a new folder and just having files under that folder didn't seem to work. I had to actually add the files by name there, which seemed wrong. I did hack the .ccproj file to use a wildcard on the folder include, which did work, but also seemed like a hack to me.

How to handle downloadable assets in MvvmCross

I have an app that synchronises content with a web server so that the app ends up with an offline and cut down version of the server based web pages. All text and html is stored in a SQLite database but what is the best approach for handling file assets? In my case this is a mix of image and audio files.
The synchronisation is all set up in the core project and my Touch project has a Content directory set up for storing the assets and my intention had been to have a similar setup for Droid. I could pass the list of files needed to the UI projects and download them from there but that seems wrong.
Thanks.
For that I would create a Service in Mvx which the ViewModels you create use for getting the external assets. Take for instance the Daily Dilbert Tutorial. You could consider the daily comics as being very similar to your external assets, where the DilbertService is used to get all the comics and presents them in a List. However your list could be a list of files located on the SDcard or where you decide to store your files.

Resources