How to reference a file in the project itself in VS.NET?

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

In a VS.NET project, is it possible to reference a file in relative path?
My immediate problem is that I want to add a key file into Assemebly.cs. I
have the .snk file in the project so I'd like to avoid adding the entire
absolute path in Assembly.cs.

Thanks a bunch for any help
Bob
 
Just add the apropriate "..\\..\\" in front of the filename.

Tip: Use @ in front of the string, then you don't have to escape it. E.g.
@"..\..\filename.snk"

The filename is relative to where the output files are located, just try a
path, if it doesn't find it will give an error, then try again.

Chris
 
You don't need to put in the entire path. Just the path it needs from the bin directory. For my projects my key file looks like this

[assembly: AssemblyKeyFile("..\\..\\my.key")

David McCarte
www.vsdntips.com
 
Back
Top