Solved

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

Posted on 2003-10-25
6
660 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

19 Experts available now in Live!

Get 1:1 Help Now