Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Update silverlight xap file

Update silverlight xap file

Scheduled Pinned Locked Moved WPF
helpannouncement
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nekkantidivya
    wrote on last edited by
    #1

    Hi, I am working on a silverlight project. In this when I try to publish my code It failed and it didn't gave me any error. So I took the old application for which publish is successfull and modified it with the changes in the code. Now the .xap file is now updating my chages and it is displaying the old functionality. If anyone have any idea to make the publish successfull or update the .xap file , please reply me. Thanks in advance.

    Z M 3 Replies Last reply
    0
    • N Nekkantidivya

      Hi, I am working on a silverlight project. In this when I try to publish my code It failed and it didn't gave me any error. So I took the old application for which publish is successfull and modified it with the changes in the code. Now the .xap file is now updating my chages and it is displaying the old functionality. If anyone have any idea to make the publish successfull or update the .xap file , please reply me. Thanks in advance.

      Z Offline
      Z Offline
      zlezj
      wrote on last edited by
      #2

      The old XAP file probably lingers on somewhere in a cache. You could try to rename the XAP file, or add a random number in the source parameter of the object tag like <param name="source" value="XapFile.xap?12345"/>

      1 Reply Last reply
      0
      • N Nekkantidivya

        Hi, I am working on a silverlight project. In this when I try to publish my code It failed and it didn't gave me any error. So I took the old application for which publish is successfull and modified it with the changes in the code. Now the .xap file is now updating my chages and it is displaying the old functionality. If anyone have any idea to make the publish successfull or update the .xap file , please reply me. Thanks in advance.

        Z Offline
        Z Offline
        zlezj
        wrote on last edited by
        #3

        OK, here's an extended version. This code appends the file date/time to the XAP file name. This way you'll keep the caching of already loaded XAP files and you don't have to remember to change the number...

        <%@ Page Language="C#" AutoEventWireup="true" %>
        <script runat="server">
        protected override void OnLoad(EventArgs e)
        {
        base.OnLoad(e);

            const string XAP = "ClientBin/XapFile.xap";
            System.IO.FileInfo fi = new System.IO.FileInfo(Request.MapPath("./" + XAP));
            string timeStampXAP = fi.LastWriteTime.ToString("yyyyMMdd\_HHmmss");
            source.Text = String.Format("<param name=\\"source\\" value=\\"{0}?{1}\\" />", XAP, timeStampXAP);
        }
        

        </script>
        <%@ OutputCache Duration="1" VaryByParam="None" Location="None" %>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
        <title>Test</title>
        <style type="text/css">
        html, body {
        height: 100%;
        overflow: auto;
        }
        body {
        padding: 0;
        margin: 0;
        }
        form {
        height: 100%;
        }
        #host {
        height: 100%;
        text-align:center;
        }
        </style>
        <script type="text/javascript" src="Silverlight.js"></script>
        <script type="text/javascript">
        window.onload = function()
        {
        document.getElementById('host').focus();
        }

            function onSilverlightError(sender, args) {
                var appSource = "";
                if (sender != null && sender != 0) {
                    appSource = sender.getHost().Source;
                }
        
                var errorType = args.ErrorType;
                var iErrorCode = args.ErrorCode;
        
                if (errorType == "ImageError" || errorType == "MediaError") {
                    return;
                }
        
                var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\\n";
        
                errMsg += "Code: " + iErrorCode + "    \\n";
                errMsg += "Category: " + errorType + "       \\n";
                errMsg += "Message: " + args.ErrorMessage + "     \\n";
        
                if (errorType == "ParserError") {
                    errMsg += "File: " + args.xamlFile + "     \\n";
                    errMsg += "Line: " + args.lineNumber + "     \\n";
                    errMsg += "Position: " + args.charPosition + "     \\n";
                }
        
        N 1 Reply Last reply
        0
        • N Nekkantidivya

          Hi, I am working on a silverlight project. In this when I try to publish my code It failed and it didn't gave me any error. So I took the old application for which publish is successfull and modified it with the changes in the code. Now the .xap file is now updating my chages and it is displaying the old functionality. If anyone have any idea to make the publish successfull or update the .xap file , please reply me. Thanks in advance.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          I don't know if zlezj's solution is necessary, but... During development I've noticed sometimes the browser will use a cached xap instead of my freshly changed xap, so I just got in the habit of clearing the browser cache every time I test. Also make sure your newer xap files are actually overwriting old ones when you publish.

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • Z zlezj

            OK, here's an extended version. This code appends the file date/time to the XAP file name. This way you'll keep the caching of already loaded XAP files and you don't have to remember to change the number...

            <%@ Page Language="C#" AutoEventWireup="true" %>
            <script runat="server">
            protected override void OnLoad(EventArgs e)
            {
            base.OnLoad(e);

                const string XAP = "ClientBin/XapFile.xap";
                System.IO.FileInfo fi = new System.IO.FileInfo(Request.MapPath("./" + XAP));
                string timeStampXAP = fi.LastWriteTime.ToString("yyyyMMdd\_HHmmss");
                source.Text = String.Format("<param name=\\"source\\" value=\\"{0}?{1}\\" />", XAP, timeStampXAP);
            }
            

            </script>
            <%@ OutputCache Duration="1" VaryByParam="None" Location="None" %>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <html xmlns="http://www.w3.org/1999/xhtml">
            <head runat="server">
            <title>Test</title>
            <style type="text/css">
            html, body {
            height: 100%;
            overflow: auto;
            }
            body {
            padding: 0;
            margin: 0;
            }
            form {
            height: 100%;
            }
            #host {
            height: 100%;
            text-align:center;
            }
            </style>
            <script type="text/javascript" src="Silverlight.js"></script>
            <script type="text/javascript">
            window.onload = function()
            {
            document.getElementById('host').focus();
            }

                function onSilverlightError(sender, args) {
                    var appSource = "";
                    if (sender != null && sender != 0) {
                        appSource = sender.getHost().Source;
                    }
            
                    var errorType = args.ErrorType;
                    var iErrorCode = args.ErrorCode;
            
                    if (errorType == "ImageError" || errorType == "MediaError") {
                        return;
                    }
            
                    var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\\n";
            
                    errMsg += "Code: " + iErrorCode + "    \\n";
                    errMsg += "Category: " + errorType + "       \\n";
                    errMsg += "Message: " + args.ErrorMessage + "     \\n";
            
                    if (errorType == "ParserError") {
                        errMsg += "File: " + args.xamlFile + "     \\n";
                        errMsg += "Line: " + args.lineNumber + "     \\n";
                        errMsg += "Position: " + args.charPosition + "     \\n";
                    }
            
            N Offline
            N Offline
            Nasenbaaer
            wrote on last edited by
            #5

            Hi. A nice idea. But it did not work for me. I use the divelement tools where I can display HTML content. And the content of this divelement controls stopps working by using your methode and does a refresh of the whole page.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups