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

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
 
C

Christopher Kimbell

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top