Solved

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

Posted on 2003-10-25
6
669 Views
Last Modified: 2008-03-17
Ok, I've officially had it with trying to work this out:

Let's say I have the following directory structure:

Programming
Programming\Solution
Programming\Solution\Project
Programming\Solution\Project\bin

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.
0
Comment
Question by:foboldfky
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:brother7
ID: 9621818
0
 

Author Comment

by:foboldfky
ID: 9622339
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.
0
 
LVL 2

Expert Comment

by:Inteliscape
ID: 9623401
this is what i use.  
<Assembly: AssemblyKeyFile(Application.ExecutablePath & "\Keyfile.snk")>
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:foboldfky
ID: 9625626
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...
0
 
LVL 2

Accepted Solution

by:
Inteliscape earned 125 total points
ID: 9627121
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
Programming\Solution

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

hope it works now
0
 

Author Comment

by:foboldfky
ID: 9633159
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...
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question