开发者

How to develop a VS2010 Silverlight Business Application without it caching the .xap file?

开发者 https://www.devze.com 2023-01-11 10:29 出处:网络
In Visual Studio 2010 I\'ve created a Silverlight app by choosing the \"Silverlight Business Application\" template.

In Visual Studio 2010 I've created a Silverlight app by choosing the "Silverlight Business Application" template.

I changed some code in Home.xaml.cs, closed Visual Studio, opened it again, and began making more changes.

But now the changes that I make to the code don't take effect at all. It's as if the entire application is cached. I can even delete the whole contents of the Home.xaml.cs file so it is blank, and pressing F5 shows me my original Silverlight app. This happens both in Firefox and Chrome. I've rebuilt, deleted the bin directory, but it keeps showing me the same old application.

What do I need to change in this template so that I can make changes to the code, and see them reflected in the applica开发者_高级运维tion?

Addendum:

I created a new Silverlight Business App, copied all the code to it, and this caches after the first change as well.

So it occurred to me to go into BusinessApplicationTestPage.asp and chang the link to the .xap file:

<param name="source" value="ClientBin/BusinessApplication4.xap?id=111"/>

So i've "fixed" the problem in that I change the id each time I run the application. And I suppose I could put a random number generator in here so that it refreshes each time. But... is this the intent? Isn't there an easier way to develop without this caching, and then only when deploying to cache like this?

Update:

Ok, just by adding that ?id=111 once, it recognizes each change now. Perhaps...


Start by using Control-F5 in IE. This not only refreshes the page, it clears the browser cache so in theory you will download a new version.


If weirdness like this is still happening you need to delete the contents of these folders...

  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

This is such a well known pain-point in older versions of Visual Studio that most web developers I know have batch files specifically for cleaning out those directories.


These folders exist so that you can alter ASP.NET applications while the application is still running. IIS will detect the changed files and copy them to the temp directory while it silently restarts your web site. Alas this doesn't always work correctly, especially when running under the IDE.


I know this isn't an ideal solution, but I have found that the IE9 Beta caches XAPs much less aggressively than other browsers, and I don't face this problem when running my Silverlight applications in it.

0

精彩评论

暂无评论...
验证码 换一张
取 消