BuZz
BuZz

Reputation: 17495

Visual Studio 2008, C# project, get filepath of a resource

I have added a DLL as a resource to my project. I need to get the file path to this DLL as I am using CSharpCodeProvider to compile something. One can only pass referenced assemblies as file paths to the ReferencedAssemblies properties of it.

I can quite easily get a byte array for my resource DLL. At the moment I write the byte array to a temp file and delete if after compilation... Isn't there better ? To me it makes sense that this file must be somewhere and easily accessible, not only as stream of bytes.

Thanks !

Upvotes: 2

Views: 675

Answers (1)

Ravindra Bagale
Ravindra Bagale

Reputation: 17673

The resource file does not have a path .
You need to read its contents using the Assembly.GetManifestResourceStream

for more information http://msdn.microsoft.com/en-us/library/xc4235zt.aspx

try this one Properties. Resources.YOUR_RESOURCE_FILENAME

Upvotes: 1

Related Questions