Where to place .snk files relative to VB.NET projects

Ok, I've officially had it with trying to work this out:

Let's say I have the following directory structure:


Where Solution is the location of my .sln file, Project is the location of my .vbproj, and bin is where Visual Studio plonks the compiled binaries.

My problem is that every time I try something like this:

<Assembly: AssemblyKeyFile("Keyfile.snk")> ' Even with ..\ or ..\..\ preceeding the path

It won't usually compile.  I say usually, because sometimes it just decides to be nice to me and compile, while other times it will simply refuse to find the file.  I REALLY don't want to put the key files in an absolute location, but I can't for the life of me work out how to get VS.NET to find them.  I've tried putting the .snk files in the Solution, Project AND bin directories, all to no avail.

Ideally, I want to stick my .snk files in the Project directory, so can anyone tell me what I'm missing?

Thanks heaps.
Who is Participating?
InteliscapeConnect With a Mentor Commented:
ok i see what i done it was this line

<Assembly: AssemblyKeyFile("..\..\Keyfile.snk")>

where my Keyfile.snk is in the same path with the solution.
in my case solution and project are in the same folder under

but this is anyway the syntax so maybe you need to add or remove some ..\

hope it works now
foboldfkyAuthor Commented:
Not quite... that uses absolute paths to reference the .snk file... I want to know how I can do it relative to where the project is.
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

this is what i use.  
<Assembly: AssemblyKeyFile(Application.ExecutablePath & "\Keyfile.snk")>
foboldfkyAuthor Commented:
Hmm... tried
<Assembly: AssemblyKeyFile(Application.ExecutablePath & "\Keyfile.snk")>
but it says that Application is undefined.  I found it under System.Windows.Forms.Application, but it then said that a constant expression was required, so I have no idea how you get that to work... maybe my copy of VS just doesn't like me...
foboldfkyAuthor Commented:
Inteliscape, yours is probably the closest.

I actually tried this with two projects, both with identical Solutions/Project file layout.

One needed ..\Keyfile.snk
The other needed ..\..\Keyfile.snk

I am convinced that VS is just toying with me.

But, since you came closest, I'll give the points to you.

Maybe someday I'll actually work out why it's doing this...
All Courses

From novice to tech pro — start learning today.