Author: Aditya Kulkarni

Web.Config Transforms

It is very common for a web applications to have different environments like follows:

  • Development
  • Staging
  • Production

There are different settings, configurations related to the application in web services (backend) or frontend which use a set of configuration defined under “Web.config”.

Web.config plays an important role in storing all the settings and configurations related to the web application. There are multiple instances where web.config defines information that controls module loading, security configuration, session state configuration and application language and compilation settings.

Connection strings are also present in web.config which vary according to the various databases used by development team.

As tracking of various settings and configuration seems (and it indeed isJ) a daunting task, it makes complete sense to have a mechanism which will provide a seamless way to pick the correct configurations according to the environments.

Enter Web.config transforms

Web.config transforms include XML markup that defines how to change web.config when it is deployed. These different changes are derived from project build configurations.

Default build configurations are Debug and Release, while custom build configurations can be created.

Build configurations

When a project is created, “Debug” and “Release” are the pre-existing build configurations.

You can create custom build configurations easily by using “Configuration Manager”.

Creating custom build configuration

In Visual Studio 2012, open a solution, and click on the drop down list for “Solution Configurations”.

ConfigurationManager

Click Configuration Manager..

Configuration Manager dialog will be shown.

In the drop down list for ‘Active solution configuration’ select ‘<New…>’ and provide a name for the new configuration.

If you wish, you can use settings from other build configurations if applicable.

When done, we will need to add the config transforms related to the new configuration created.

Adding Config Transforms

Right click on web.config in the corresponding solution to see the context menu.

Select “Add Config Transforms”.

This will result in creating the transforms for the related build configuration.

For instance, I have created build configurations as – ReleaseStagingPM, ReleaseStaging, and ReleaseProduction, in addition to pre-existing Debug and Release.

The config transforms are created as below:

TransformedWebConfig

As shown, with respect to each build configuration, there is one web.config.

So? What it has for me?

With the use of XDT transforms, web.config transforms provide a very simple and efficient way of managing your configuration parameters.

For instance, my original web.config contains following:

<client>

<endpoint address=”http://localhost:50047/MyService1.svc&#8221; binding=”basicHttpBinding”   name=”BasicHttpBinding_IMyService1″/>

There is a web service called “MyService1.svc”. For the purpose of development and frequent debugging, I am pointing it to http(colon)//localhost(colon)50047/, which is the development environment.

Now, when I configure my respective “transformed” web.config, I use XDT transform to let web.config transforms know what pointing I am intending to change.

This is achieved by following line of code.

<system.serviceModel>

<client>

<endpoint address=”http://www.MyDomain.net/MyService1.svc&#8221; binding=”basicHttpBinding” bindingConfiguration=”BasicHttpBinding_IMyService1″ name=”BasicHttpBinding_IMyService1″ xdt:Transform =”Replace” xdt:Locator =”Match(name)”/>

Now, if you observe the last two parameters, they employ XDT transform “Replace” to replace the line of code, by identifying “name”. It is highlighted in bold black font.

More syntax for XDT transform can be found at: http://msdn.microsoft.com/en-us/library/dd465326%28v=vs.110%29.aspx

As a result, when I am building the web application, the “transformed” web.config will have above endpoint instead of my development environment endpoint.

In this way, an efficient use of web.config transform enables quick changes in web.config according to environments. This leads to faster deployments.

Advertisements

Setting up Eclipse IDE for APS Packaging

To get started with APS packaging, you will need following things:

• Eclipse IDE : To develop/create packages
• Parallels Plesk Panel: To test the package at the local instance for functionalities
• APS Certification System subscription: To judge the certification level of package created.

In this particular post, I will take you through the process of installing Eclipse and use it for debugging.

Download Eclipse IDE

You can download Eclipse from the URL:

http://www.zend.com/en/community/pdt/downloads

On the page that gets displayed,

Eclipse_Download

Download Zend Eclipse PDT.

This is the most efficient and well equipped Eclipse IDE that you can use for APS packaging.

Create the APS environment in Eclipse

Once you are done downloading Eclipse, extract and open Eclipse.

Click on Help menu, select Install New Software…

APS_Ecl2

In the “Work With” location bar, enter following URL.

http://www.apsstandard.org/r/doc/sdk/eclipse-plugin

It will eventually display the APS Plug in to install. Check select APS.

Complete the wizard to install the APS Plug in.

Create separate perspective for APS

From the Window Menu, select open perspective. Click Other…

Select APS from the list.

APS_Ecl3

You will be presented with APS perspective.

Here you can start your APS packaging.

Creating your simple APS package using template

To get started with APS packaging, let us create a sample package using a template.

Make sure you are in the APS perspective.

From New menu, select new Project…

You will be presented with a wizard.

APS_Ecl4

Select APS Project, click Next.

On the next screen, give the project a name. From the available radio buttons, select New Project from Template.

From the templates, select Sample_Package_with_License-1.2.1.app

Click Finish so that you are presented with the newly created package.

Start debugging the scripts

For the scripts to be debugged, you need to use the APS Player feature.

Click on the APS player from the Run menu. It will start a new session, where you have to enter the environment variables necessary for the application to run.

That is all for now, will be back with more in APS packaging. This is very crucial article as far as development is concerned, so feel free to ask any questions!  🙂

Introduction to Application Packaging Standard (APS)

Application Packaging Standard gives a medium to package your Software-as-a-service (Saas) application. I got a nice experience of working with such packages and thought it would be good to blog it out!

First off, I would like to create a scenario where you have a web application, which can be deployed to a panel which will be handling your application. So, in such scenario, the package, when deployed, will be working as per your requirement.

In my case, I used Parallels Plesk Panel to achieve the purpose. I had to download it from the website, and install it on my local machine so that I was able to install the packages that I am going to develop.

In my case, I was more than curious to have my IIS-based application on the Plesk panel, so I installed the Plesk panel with ASP.NET support as well as SQL Server Database support.

Having created a scenario for installing and deploying the APS package, we will go through a short but important explanation of APS package.

An APS package is basically a simple compressed package, with an extension .app.zip. It is important to note that creating a mere compressed package will not work; it should follow some standards which are provided at the APS website.

Introduction to APS Specification

It provides a set of rules to be followed by a package in order that the package will be APS compliant. I will just borrow some material from APS website as an illustration to the things I am going to explain.

Following figure from the APS specification page clearly illustrates the package contents.

Img

I will go into details of each entity.

APP-META.xml

This file is responsible for keeping a track of following elements.

Application Information
  • General information: application name, version, change log, etc.
  • Vendor information: name, website, etc.
  • Packager information: characteristics of package manufacturer. It also includes a very important field, called package uri, which must be kept unique as far as each version/release of the application is concerned.
  • It also includes summary, category & description of the application and screenshots for the application.

These things are covered under application information element.

Services
  • Each application offers some service to its users. These services are specified in the services element.
  • There can be a license agreement, settings for service instance, control elements to be added to the user interface included in the services element.
  • Settings for service instance can also be included in the services element.

The APP-META.xml file follows simple xml schema architecture for the structure.

APP-LIST.xml

This particular file is responsible for keeping a track of all the files and folders present in the package. More importantly, this file also conveys useful information about each file in the package as far as hash value, size of the file is concerned. This is very important so as to track the changes in each file as various packages can be issued for any given application.

Scripts

This folder involves all the scripts which are necessary for an application package to work.

The important and very first file responsible for overall installation and functioning of the package is configure file. This file is included in the scripts folder, which is thereby invoked at the time of installation.

You can also insert the SQL scripts in the folder as declared in the configure file. I will be taking your through a detailed package creation tutorial, where you will actually get an exposure so as to how to create a package which is APS complaint, more or that later.

In the end, for a proper functioning of your package, the steps or the scripts are invoked by using files in this folder.

Images

This folder takes care of the branding of the package.

All the icons and screenshots are packed in this folder. Icons, particularly for an application, which are visible on the panel where you will be uploading the apps, are redirected from this folder.

The icons of packager, vendors are also present in this particular folder.

Htdocs

This is very crucial and important folder of the package, where you will put all your application files.

Particularly speaking, considering an example of a simple IIS-hosted web application, the published files are kept here in the folder.

This was all about a short and simple description about how the APS packages are and how they exist.

In the proceeding posts, I will take you through the environment for APS packages in detail.

Content Localization in SharePoint 2013 using resource files

SharePoint supports content localization to enable the site members to have a SharePoint site in their very own languages. This is very innovative feature of SharePoint with which one can create multilingual sites very easily.
When it comes to creating a multilingual site, particularly, a developer concentrates on the parts on which localization is to be applied. As we know for any SharePoint site, we have a page, where we have, page content, few webparts, header and footer.
With advent of Machine Translation Service in SharePoint 2013, one can easily have a translation of page content by using Microsoft Translator Service. As far as other parts of the page are concerned, web part, particularly, can have some difficulties translating each and every content.
For the same, we can use a resource file, which will enable the webpart interface to adopt to specific language. In this particular post, I will be describing a step by step method to get some content localized by using resource file.

Instructions to create the webpart

Create an empty Visual Studio Project.

Content_1

Provide a website to debug the solution and select “Deploy as farm solution”.

Content_2

Let us add a visual webpart in the solution, named SampleWebPart using New Item option in Add menu.

Content_3

I have added two labels with the id as shown below.

Content_4

It is time to add our resource files. For the same, we’ll map a resource folder

I will right click on the solution and select Add, where I will find SharePoint Mapped Folder.

Content_5

Content_6

After selecting resources in the proceeding screen, I will be able to see a resources folder in my solution.

In the Resources folder, I will create the resource file, by clicking Add Item.

Note the file name for the resource file: Resource.en-US.resx

Content_7

Add some content to the resource file.

Content_8

In the same way, create another resource file for the other language required.

Content_9

Now we’ll do some programming to get our localization working.

Add following two lines in Page_Load event in SampleWebPart.ascx.cs.
Content_10
Create a function named LoadResource along with an enum as shown below.

Content_11

We are ready to go!

Just build and deploy the solution!

The preview on English Site

Content_12

The Preview on Hindi Site:

Content_13

Variations in SharePoint 2013

SharePoint 2013 is packed with many outstanding features. Variations, which were introduced way back in SharePoint 2007, still find its existence in SharePoint 2013.

The upgraded or the new feature in SharePoint 2013 is the ability to translate via Microsoft Translator.

For this particular context, we will learn how to make use of variations in your site.

Prerequisites:

A SharePoint 2013 site with publishing feature

Machine Translation Service already activated.

Instructions on how to activate the Variations

When it comes to activating the variations, we will achieve our purpose by following steps:

  • Create a source site, which will be in English
  • Create a target site, which will be derived from Source site, which is in English.
  • For the purpose of the document, we are having target site in Hindi.
Verify the Variations Settings

Go to Site Settings.
Under Site Collection Administration, click Variations Settings.

img1

Variations Settings Page will show up.

Do the settings as per your need. For example, if you want to update the content on target site manually, you can set the options on this page accordingly.

Create the source variation

From the Site Collection Administration, click on Variation Labels

Following screen will be presented.

img2

We will start with Adding a label.

Click New Label.

Now, we are in process of creating a source variation from where the content will be derived. To do so, select the locale as English (United States). This will act as our default source language.

img3

Give any site location from where you want the source variation to be created. As already described on the page, you can also specify a top-level site by typing / in Variations home field.

img4

You can specify a label name and description for this particular label if needed.

img5

When the source variation is created, one can receive an e-mail notification (if configured) via the Label Contact field. You can enter any site member name here to direct the notification to the person.

img6

Click OK

One thing I liked more about SharePoint 2013, it makes the user comfortable from each of its notifications!! 🙂

You will be comforted with following screen.

img7

The creation of the source variation will depend on the timer job settings. You can modify them under the Central Administration -> Monitoring -> Review Job Definitions

As a result, your source variation will be created.

img8

Creating target variations

Again, under Site Collection Administration, click on Variation Labels

Click New Label, you will be presented with following screen.

img9

In my case, I am going for a Hindi target variation. So, I’ve selected the same in Locale.

Click Continue.

Enter Label Name, description and display name, if needed.

Click Continue.

img10

It gives you an option to go for human translation, where you can create a XLIFF file and do the translation on the target site.

Click continue

img11

On this particular page, you can go for the page update settings as per your requirement.

Click continue

Review the label settings and click finish.

As a result, as soon as your timer job completes, you will be able to see the following screen.

img12

On the left pane, you are clearly able to see the two variations created.

For testing purpose, we will create a page on Source Site (English) and see if it is generated on Target Site (Hindi).

For the same, create a page on source site via the Gear menu.

img13

Check in and publish the page.

Go to Variation labels from Site Collection Administration.

Click on Create hierarchies.

From the ribbon menu,

Click Publish, under which click Update all targets.

img14

You will be able to see the above message.

As a result, you will be able to see a page in the target variation.

img15

That’s all! 🙂

Your first Windows Store App

It is been a while Windows 8 is out, and being a techie, I was more than excited to use Windows 8. Yes, there are so many exciting features which include the Tiles, the Metro Interface! By the way I don’t think I am the only one who had a hard time getting used to the Start button as well as Settings button which is at the right pane or “Charm Bar!” 🙂

When overall UI is explored and observed, it was time to get into the actual Windows 8 App Development. Maybe it is my early days of development in Windows 8, but still, I found it interestingly amazing!

So, if the excitement is triggered above the limits, let us get started with your first app in Windows 8!

Prerequisites:

  • Microsoft Windows 8 (obviously!)
  • Microsoft Visual Studio 2012 with Developer License
    • Particularly, developer license is required to get the things going with Windows Store. It won’t allow you to develop any app unless you have the developer license.

So, when the prerequisites are finalized, let us develop the first “Hello World” app.

Steps to create your first Windows Store app:

  • Open Visual Studio 2012
  • Goto File Menu -> New -> Project..

You will be presented with the following screen

app1

Select Windows Store from Visual C#.

Out here, you have so many options for an app, for now, we will go for a Blank App (XAML)

  • Give a name for your app. Click Ok. You will be able to see a screen where App.xaml.cs is opened for you. This file, particularly, controls the whole operation of your app.
  • From the solution explorer, open the MainPage.xaml file. The following screen is displayed.

app2

As we have selected the blank app, you are able to see this blank “Slate”. You are able to design whatever you want from here.

  • Let us do some designing!From the toolbox, which is at the left pane, select a “Text Block”. If you’re an asp.net developer this is “label” for your understanding!  Drag and drop TextBlock.I always like to use the split view in Visual Studio, as you can see, if you’ve added the TextBlock, immediately changes in xaml code are also reflected. In quick succession, I assign the fontsize property to my TextBlock for making it appear a little big!

app3

  • So, in quick Succession, insert a button, which will be displaying a “Hello World” when clicked on it. The current TextBlock will be “My First Store App”.
  • Insert another TextBlock  and make it invisible.  So, finally you will be having the following screen.
    app4
  • Lets do some simple code.
    I just generate a click event for the button by double clicking on it, make another TextBlock visible to show our message, in the following code.
    One of the most crucial steps, which we often forget is to assign a TextBlock with “Name” property. Particularly, in Windows Store Apps, this particular step should not be missed.
    app5
  • The code:
    app6
    Note how the visibility property is used.
  • To see the result, click on the drop down arrow besides debug.
    app7
  • You can have a selection between a Simulator, Local Machine and Remote Machine.I prefer simulator. So, click on simulator to run your first app!It will build deploy and present you the app.First Screen:
    app8
    When clicked on “Click Me” button, you get presented with the following Screen
    app9

That’s the very first Hello World App you created for Windows Store!

Hope you liked it! 🙂

DotNetNuke Installation Guide

DotNetNuke is the Web Content Management Platform to build web sites and web application. Powered by the .NET development platform, DotNetNuke features powerful modules and interface making it stand apart from its CMS competitors.

This tutorial, being an introduction for establishing a DotNetNuke site, will take you through the important steps to get your site up and running.

This tutorial is for installation of DotNetNuke Community Edition.

For the purpose of introduction to DotNetNuke installation, the database instance used in the tutorial is SQL Server 2005 / 2008 / 2008R2 / 2012 Express with user instance database.

The operating system used to install is Windows Server 2008 R2.

Step 1: Requirements and Installation Media

The requirements for DotNetNuke are as follows:

  • Supported Operating Systems
    Windows XP
    Windows Server 2000
    Windows Server 2003
    Windows Vista
    Windows 7
    Windows 8
    Windows 2008
    Windows 2008 R2
  • Web Server
    Microsoft IIS 5.0, 5.1, 6.0, 7.0, 7.5, 8.0 
  • Database Server
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2005 Express
    Microsoft SQL Server 2008 Express
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2008 Express R2 
  • .NET Framework
    3.5 SP1
    4.0
    4.5 
  • Recommend Environment
    Windows Server 2008 R2
    IIS 7.5
    SQL Server 2008
    .NET Framework 3.5 SP1

Installation Media:

Obtain the installation media from the following link:

http://dotnetnuke.codeplex.com/releases/view/93277

In this tutorial, DotNetNuke 06.02.03 release is used.

Step 2: Prepare the DotNetNuke Environment.

    1. Once you’ve downloaded the latest stable release from the link provided above, extract the contents of the zip file to a folder on your computer.
    2. Create a directory in the C:\inetpub\wwwroot\ location named DNN.
    3. Copy the contents extracted from the package downloaded to this newly created directory.
    4. Right click on DNN directory; select properties. On the security tab, you’ll be presented with following screen.Ste2_4
    5. In this step, we will be adding the permissions for the appropriate user, in our case, as we are using Windows Server 2008 R2; we are required to add permissions for user “Network Service”.  Note: Windows XP uses the local ASPNET account, Win2003/Vista/2008/7 use the local Network Service account
    6. So, on the above screen, click on Edit. On the proceeding screen, click on Add. Now you will be able to see the following dialog box.Step2_6
    7. In the “Enter the object names to select:” field, type in “Network service”. Click on Check Names. You’ll be able to see Network Service underlined in the same field. This shows the user which you’ve entered is valid.
    8. Click Ok, you’ll be able to see the previous screen where Network Service will be listed under Groups or user names.
    9. Under permissions for NETWORK SERVICE, check select allow Full Control.
      Step2_9
    10. Click OK, also click OK on DNN properties screen! All OK!
    11. Now, it is time for the most crucial step in the DNN installation. IIS MANAGER!
    12. Click Start, goto Run.. And type in “inetmgr”.Step2_12
    13. You’ll be presented with a calm screen of IIS Manager.
    14. Expand Sites, you’ll be able to see the “Default Web Site”.Step2_14
    15. Expand it too!
      Step2_15
    16. Right click the directory, DNN. Select “Convert to Application”.
    17. Click OK on the dialog box that appears.
    18. Hooray! The necessary steps for preparing the environment are complete!

Let us move on to the next step where we’ll be installing the DotNetNuke.

Step 3: Installing DotNetNuke

 

  1. Browse to the site using http://localhost/DNN
  2. The following screen will be shown. Make sure under installation method, Typical is selected. Click Next to continue.Step3_2
  3. On the File Permissions screen, make sure you are able to see the following message-
    Your site passed the permissions check.
    Yes, you should be able to see it in green ONLY!
  4. Click Next to continue.
  5. Next Screen is the database connection configuration. We don’t have to do anything out here as the default option selected is SQL Express Database. Click Next.
  6. It will start building the database for your DNN site. It may take a while.
  7. When you’re able to see following screen, the installation of DotNetNuke site with database as SQL Express is DONE!!Step3_7
  8. Click Next to contiue.
  9. Next screen will let you set a host account for DNN site.
  10. Enter the password, a valid e-mail address to finish the installtion. Click Next to finish.

Your DNN site is created, the Getting Started screen is shown.

As described initially, this guide is for the DotNetNuke installation with SQL Server 2005 / 2008 / 2008R2 / 2012 Express with user instance database.

In the next edition of the DotNetNuke guide, I’ll be taking you through the DotNetNuke installation with SQL Server 2005 / 2008 / 2008R2 / 2012 or Express edition with attached database.

🙂 🙂  Happy New Year 2013 🙂 🙂  !!