Showing posts with label Silverlight. Show all posts
Showing posts with label Silverlight. Show all posts

Wednesday, 27 February 2013

Silverlight Deployment


1.       What is the single unit for deploying Silverlight applications?


Silverlight applications are downloaded by the browser in XAP files.

2.       What are xap files?


                XAP files are essentially .zip files that contain an assembly manifest file and one or more assemblies.

3.       Can an APACHE server host a Silverlight application?


              Silverlight applications can be hosted on most types of Web servers, like Internet Information Server (IIS) or Apache. However, most Web servers are usually configured to serve only a short list of wellknown file extensions.

4.       What are the MIME types your web server should support to host Silverlight application?


Extension
MIME type
.xaml
application/xaml+xml
.xap
application/x-silverlight-app



IIS 7, included in Windows Server 2008, already includes all the relevant MIME types for both WPF and Silverlight, including both .xap and .xaml extensions, so if you're using Windows Server 2008, you're all set.
5.       How can you optimize xap file size for increasing download speed?

a.       Set CopyToLocal as false

By default, any non-system assemblies that you reference will be added to the XAP file generated by Silverlight applications. If you want to optimize your XAP files for download speed, this behavior may not be efficient for some of your modules' references.

Consider the following example. You have created an application with several remote modules. Each module gets its own XAP file. You have also created a shared Common assembly that contains shared services, common interfaces, and so on. Each module references that common assembly. By default, each XAP file will now also contain the Common assembly; this makes the XAP files larger than they need to be.

b.      To solve this, change the references to the Common assembly in all of the modules by setting Copy Local to false. This ensures that the Common assembly is not added to the XAP files.

When deploying Silverlight applications created with the Composite Application Library, some common assemblies that can typically be excluded from the XAP files include Composite and Composite.Presentation assemblies and infrastructure assemblies, among others.


6.       How can you deploy Silverlight app.

c.       You can do it using a SMS server.

d.      Manually

e.      Group policy

Group policy is ideal to deploy Silverlight in small to medium sized organizations or when it is not being deployed to a large number of users simultaneously.  For large organizations, Silverlight is best deployed using SMS or another third-party software distribution tool.  A limitation of the group policy deployment method is that it applies only to Microsoft operating systems, ignoring Apple operating system clients. 


7.       How do you know if the problem which has occurred is a web browser problem and not a Silverlight issue?


To isolate browser issues that might be related to the Silverlight add-on, you can selectively disable the add-on in Internet Explorer 7.

To disable a browser add-on

a.       Click the Tools menu, click Manage Add-ons, and then click Enable or Disable Add-ons.
b.      Change the “Show” Drop-down box to “Add-ons that have been used by Internet Explorer”
c.       Click AgControl Class, click Disable, and then click OK.

Alternatively, you can turn off all add-ons temporarily in Internet Explorer 7 by starting in No add-ons mode.

To start Internet Explorer 7 in No add-ons mode

a.       1.    Click Start, click All Programs, and then click Accessories.
b.      2.    Click System Tools, and then click Internet Explorer (No Add-ons).

You can also start Internet Explorer without add-ons by right-clicking the Internet Explorer icon on the desktop and then clicking Start Without Add-ons. Or start Internet Explorer with no add-ons or toolbars by running the command iexplore.exe -extoff.


8.        What is difference between asp.net application hosting and Silverlight hosting?

Deploying Silverlight applications is as easy as deploying ASP.NET applications, because Silverlight is normally embedded in a site.


9.       To install a Silverlight RIA Services application, do we need RIA services installed in the server machine?

To run Silverlight RIA services application we need .NET 4 installed on the server machine. RIA Services must also be available on the Web server.



The RIA Services assemblies must be available on the Web server. It is recommended that RIA Services be installed on the Web server that will host your application. If this is not an option, due to lack of permissions or some other issue, you can also make them available on the Web server by either including them in the bin folder of your project when it is published or by installing them in the global assembly cache (GAC).

 To install RIA Service RC on your server, download the MSI locally and then run it as such -

msiexec /i RIAServices.msi /SERVER=true

 If you have access to a .NET 4 RC server but do not have permissions to install RIA Services on it, you can choose to carry the RIA Services bits in the Web Applications BIN folder.

 10.   What all should you consider while preparing a WCF RIA Service application for deployment?

Following is what is needed:

·         System.ServiceModel.DomainServices.Server.dll

·         System.ServiceModel.DomainServices.Hosting.dll

·         If you are using Entity Framework to access a database, then you will also need to add a reference to the System.ServiceModel.DomainServices.EntityFramework.dll assembly.

·         If you are using LINQ to SQL to access data, then you will need to add a reference to the Microsoft.ServiceModel.DomainServices.LinqToSql.dll assembly

If you are using the Visual Studio Build->Publish option to deploy your application, make sure the following three assemblies under the Web Application->References have been marked as Copy Local = True


11.   Ideally where should my RIA service dlls lie in GAC or in bin?

Instead of copying the RIA Services assemblies in the Bin folder of every project that uses them, you can install the assemblies in the GAC. Any assemblies in the GAC are available to every application on the server. This approach is easier to maintain because an assembly only needs to be updated in the GAC instead of every Bin folder.

If you are copying the bits over manually to your deployment server, copy the above three assemblies to the Web Applications BIN folder right next to your [WebAppName].dll


12.   What is need to make the assemblies Copy Local = True?

Setting these property values to True results in the assemblies getting copied to the bin folder the next time you build the solution. When the assemblies are copied to the bin folder, they will be copied to the Web server when you publish the site.


13.   Why my installation works in some PCs and fails to run in other PCs?

Generally this happens because it makes zero sense to have Copy Local = True if an assembly is installed in the GAC.

Because the local copy will never be used, the GAC is always searched first. Leaving it unchanged would cause major confusion. Changing it causes a confusion too, that could perhaps have been addressed with a message box at solution load time.

To overcome this problem you can also add a PostBuild event to manually copy the assemblies into the output directory.


14.   Why Copy Local for some dlls is true by default whereas for some others it is true?

The project-assigned value of CopyLocal is determined in the following order:

1.       If the reference is another project, called a project-to-project reference, then the value is true.

2.       If the assembly is found in the global assembly cache, the value is false.

3.       As a special case, the value for the mscorlib.dll reference is false.

4.       If the assembly is found in the Framework SDK folder, then the value is false. Otherwise, the value is true.


15.   What are the things you need to take care in web.config file while deploying a RIA service?


Wednesday, 30 January 2013

Layout : Xaml

If you are familiar with Silverlight , WPF Xaml , you may find this blog very basic.
If you are new to Windows 8 app/phone app development and want to understand UI layouts then you are at the right place.

What do you mean by UI Layout?

In my last article I explained containers. Containers tell you how your controls are held on the UI , layout defines how the containers or the controls inside the containers are positioned.

If layout of your application is proper , the UI is not going to get distorted on different devices and different resolutions. The main concept of Windows 8 was Develop Once and Port anywhere. For this porting to happen smoothly we need to be careful enough when we are selecting layout of the xaml page.

For a canvas container you always define the controls at their absolute positions , for a grid/stack panel you define the controls in a relative manner.

So , if your app is targeted towards various devices the best I will suggest is grid and stackpanel.

Now that we are settled with the grid/stack panel as container , let us think on how to position them.

Windows 8 Phone/App supports two types of layout.
a. Absolute Layout
b. Dynamic Layout

Absolute layout should be used when you can define the absolute positions of the controls. That is you define exact locations of all your child elements relative to the parent.If the app requires absolute positioning of UI elements, you can design different pages for different screen resolutions or use scaling as an alternative.

By default the layout is absolute and container is grid for a Windows 8 app.

Dynamic Layout:

You specify the relative positions for all your controls.To use automatic or proportional sizing, you must assign special values to the Height and Width properties.

Microsoft recommends following for a dynamic layout:
(Following lines are taken as is from msdn)

  • Set the Height and Width of the control or layout to Auto. When these values are used for controls in the Grid layout, the control fills the cell that contains it. Auto sizing is supported for controls and for the Grid and StackPanel layouts.

  • For controls that contain text, remove the Height and Width properties, and set the MinWidth or MinHeight properties. This prevents the text from scaling down to a size that's unreadable.

  • To set proportional values for the RowDefinition and ColumnDefinition elements in a Grid layout, use relative Height and Width values. For example, to specify that one column is five times wider than another column, use "*" and "5*" for the Width properties in the ColumnDefinition elements. 

Conclusion:
If you have a screen that should readjust itself based on reolutions my suggestion is use Grid with Dynamic layout.

Monday, 30 July 2012

Dependency Property : Silverlight/WPF

WPF/Silverlight introduce a new property called dependency property. In this article we will see

  • What is a dependency object
  • What is a dependency property
  • Compare dependency property with CLR property
  • Advantages of dependency properties
  • Attached Properties