What is application's site of origin and when to use it

sudarsanyes picture sudarsanyes · May 18, 2011 · Viewed 10.2k times · Source
  • What is application's site of origin
  • When to use it
  • How is the build action of a resource file associated with it
  • What is the difference between pack://application:,,, and pack://siteoforigin:,,,

Answer

Daniel Rose picture Daniel Rose · May 18, 2011

The site of origin is the location (i.e. the physical folder) of the application executable assembly (i.e. the .exe that the user runs). The URI is thus relative to that folder.

Example: You have

  • C:\Programs\MyApp\MyApp.exe
  • C:\Programs\MyApp\MyIcon.bmp
  • C:\Programs\MyApp\Icons\MyOtherIcon.bmp

The pack URIs are pack://siteoforigin:,,,/MyIcon.bmp and pack://siteoforigin:,,,/Icons/MyOtherIcon.bmp when running the MyApp.exe. That means you have to copy those files to those places.

In contrast, the application pack URI refers to resources embedded in your assembly (by using Build Action "Resource").