Solved

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

Posted on 2003-10-25
6
661 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Service to Receive TCP Packets 4 117
MVC5 Dataformat String for Phone not working 3 25
Getting multiple values from a dataset ASP.NET(VB) 3 37
Problem to error 4 43
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now