AndiDog
AndiDog

Reputation: 70208

Getting filename of content file in Silverlight

I need to get the filename for a file linked with my Visual Studio project as "Resource", "Embedded Resource" or "Content" (doesn't matter which). How can I get the absolute or relative path for it? The problem is that my application runs with current directory "C:\Program Files\Microsoft Silverlight" (because it's OOB?!), so I can't just set the file to "Copy if newer" and use a filename relative to the assembly execution directory.

Upvotes: 2

Views: 425

Answers (1)

Eilistraee
Eilistraee

Reputation: 8290

A resource embedded in your Silverlight application can't have a relative file path per se.

If you choose embedded resource or resource, the file will be embedded in the project dll as a resource.

If you choose "content", I think (but I am not entirely sure) that the file will be embedded in the XAP file of your Silverlight application.

Either case, it's in the application package (the XAP file) , and therefore isn't really reachable from outside.

Upvotes: 1

Related Questions