silverlight 4, dynamically loading xap modules

后端 未结 4 934
无人共我
无人共我 2021-01-18 08:56

I know that it is possible to load xap modules dynamically using Prism or MEF framework. However, I\'d like not to use those frameworks; instead load my xap files manually.

相关标签:
4条回答
  • 2021-01-18 09:10

    Ok, I found the cause. The above code works. After creating a new silverlight project (Sales.xap) I happened to compile my solution once. Then I deleted App class in the Sales.xap and renamed default MainPage class to SalesView. However, no matter how many times I compile my solution, Visual Studio's development web server was loading the first version of Sales.xap (where from?), so my code couldn't find SalesView. In my host Asp.Net project I set development server's port to a different port number, and the problem gone. So the problem was with Visual Studio's development server. Apparently it is keeping compiled xap files in some temporary folder, and doesn't always update those xap files when source code changed.

    0 讨论(0)
  • 2021-01-18 09:11

    What I do to avoid such problems when executing freshly compiled Silverlight is clear the browser cache, chrome even has a clear silverlight cache ;)

    0 讨论(0)
  • 2021-01-18 09:25

    this XAP Cache phenomena is often due to the visual studio embedded web server (ASP.NET Development Server). Just stop the occurence of this server and the cache will be cleared. Start again your project and the latest build of your xap is called.

    0 讨论(0)
  • 2021-01-18 09:28

    This is based on the asker's self-answer below, rather than the question.

    If you delete a project/module the output DLLs/XAP files do hang around. If you click the "show all files" button you will see some these left-over output files in your clientbin, bin and obj folders of related projects.

    alt text

    You can delete them individually from the project, or, when in doubt, search for all BIN and OBJ (e.g. using desktop explorer) and delete all those folders. The BIN/CLIENTBIN/OBJ folders will be recreated when needed (this the job that the "clean" option in Visual Studio should have done!)

    Hope this helps.

    0 讨论(0)
提交回复
热议问题