1

I've created a new Silverlight 3 from template and started a debugging session. However, when I looked to the modules window I saw the following:

Modules window

The path to my Silverlight3Application.dll was lacking (even though the pdb was found just fine). I made sure that it isn't just a UI issue, indeed I could delete the Silverlight3Application.dll file that was located next to the PDB just fine without any issues.

Questions:

  1. Where is my DLL actually loaded from UPDATE in runtime?
  2. Why isn't it loaded from the expected location?
  3. Is it possible to make it load from the location next to the PDB file, where I actually expected it to load from?

Update 1

What I really need is to find out the location of my Silverlight3Application.dll in runtime, using Reflection, for example.

However, just as the modules window hides the real location, so does reflection:

  • Assembly: {Silverlight3Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null} System.Reflection.Assembly {System.Reflection.RuntimeAssembly}
  • FullName: "Silverlight3Application, Version=1.0.0.0, Culture=neutral, publicKeyToken=null" string
  • ImageRuntimeVersion: "v2.0.50727" string
  • IsDynamic: false bool
  • Location: "" string

I've tried located this assembly manually using Prcocess Explorer and its location seemed rather random:

C:\Users\Vitaly\AppData\Local\assembly\dl3\G1KDTYO5.XJ3\6GQ19BER.4OW\5e5cbf28\50366acf_1a3ecc01\Silverlight3Application.dll

Anyone knows how I can find the location of the assembly in runtime? If nothing else works, using external tools is an option, however, I must be able to execute the tool from code. I'll be happy to hear ideas.

Thanks!

VitalyB
  • 12,397
  • 9
  • 72
  • 94

2 Answers2

1

By default, Silvelight DLL is located in \Bin\Debug of your Silverlight project.

If you want to see where an actuall DLL is loaded from:

  1. output path is visible in Visual Studio Output Window during build
  2. use ProcessMonitor.

Also see http://msdn.microsoft.com/en-us/library/cc838164%28v=vs.95%29.aspx for detailed description of Silverlight project structure.

To your Update1: see How do I get the path of the assembly the code is in?

Community
  • 1
  • 1
Tomas Voracek
  • 5,886
  • 1
  • 25
  • 41
  • Hi Tomas, the path that I found via Process Explorer is: C:\Users\Vitaly\AppData\Local\assembly\dl3\G1KDTYO5.XJ3\6GQ19BER.4OW\5e5cbf28\50366acf_1a3ecc01\Silverlight3Application.dll, however. I still don't understand how to get it without using these tools. I'll refine my question further to get what I really want to have. – VitalyB Jul 10 '11 at 21:37
1

Have you considered how the assembly is actually executed in your browser? It comes from a .XAP file, not via any DLLs built/stored under your project folders. More specifically, your project builds a DLL, which is then packaged into the XAP file, which is in turn served to your web browser, which unpacks the XAP file, reads the manifest, and loads the specified DLL entry point.

The path to the DLL from the XAP root is, well, the file name (unless you've done customized the XAP yourself). That's probably why there isn't any path specified.

Jimmy
  • 27,142
  • 5
  • 87
  • 100
  • Jimmy thanks. It makes sense. Is there a way for me to get the path to the extracted file in runtime? I find it rather weird that reflection doesn't work well in this case. – VitalyB Jul 11 '11 at 11:44