WPF from Desktop to Web

Lets see how to convert a Desktop WPF application in a Web Application. I am using VS 2005 for this.
First of all we need to go the the project properties, and click on the "Signing" button in the left side. Mark the checkbox labeled "Sing the ClickOne manifests" and click the "Create Test Certificate" button.
After that, go through all your .xaml and .xaml.cs Windows and change Window for Page either in the xaml and extending from
System.Windows.Controls.Page in the partial class.
Now save everything and open the solution file (.cs.prof file) with an ascii text editor and add this lines in the first PropertyGroup:

<ApplicationExtension>.xbap</ApplicationExtension>
<MinFrameworkVersionRequired>3.0</MinFrameworkVersionRequired>
<HostInBrowser>True</HostInBrowser>
<Install>false</Install>
<MapFileExtensions>false</MapFileExtensions>
<IsWebBootstrapper>true</IsWebBootstrapper>
<BootstrapperEnabled>true</BootstrapperEnabled>
<PublishUrl>Publish\</PublishUrl>
<StartArguments>-debug "$(MSBuildProjectDirectory)\bin\
$(Configuration)\
$(AssemblyName)$(ApplicationExtension)"</StartArguments>
<StartAction>Program</StartAction>
<StartProgram>$(WINDIR)\System32\PresentationHost.exe</StartProgram>

The folowing tags should be within the file as well but they should be autogenerated:

<OutputType>winexe</OutputType>
<SignManifests>true</SignManifests>
<SignAssembly>false</SignAssembly>
<ManifestCertificateThumbprint> SOMETHING <
/ManifestCertificateThumbprint>
<ManifestKeyFile> SOMETHING_TemporaryKey.pfx</ManifestKeyFile>
<GenerateManifests>true</GenerateManifests>
Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
  • Anil

    hi,
    thanks for helpful article!

    I am getting security issue
    while converting:

    System.Security.SecurityException: Request for the permission of type ‘System.Security.Permissions.UIPermission, mscorlib Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

    could u help?

  • http://carlosble.com Carlos Ble

    Hi!
    I was getting the same error but I don’t remember how did I fix it :-(. I found something in Google regarding the security configuration. Sorry and good luck

  • Anil Baviskar

    this is due to security settings in application.
    For this set the security properties by
    project–Properties–security–>Include proper permissions required for ur project.

  • http://carlosble.com Carlos Ble

    Thanks for the information! It may be useful for other people 🙂

  • shimna

    SqlClientPermission permission = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
    permission.Add(connectionstring, ” “, KeyRestrictionBehavior.AllowOnly);
    permission.PermitOnly();

  • http://carlosble.com Carlos Ble

    Thanks man!

  • http://www.aminokwasy.odzywki-warszawa.eu/cat/aminokwasy Aminokwasy BCAA

    I’ve been exploring for a little bit for any high-quality articles or blog posts on this kind of area . Exploring in Yahoo I at last stumbled upon this web site. Reading this info So i’m happy to convey that I’ve an incredibly good uncanny feeling I discovered exactly what I needed. I most certainly will make certain to do not forget this web site and give it a glance regularly.

  • Krishn

    Hi
    We have one desktop WPF desktop application which we need to convert WPF Browser application so that we can run the same in our asp dot net based website
    Pls help.

  • pradeep

    wat i need to change windows to page; system.windows.controls.Usercontrol to system.windows.controls.page and do i need to usercontrol to page also