Solved

how dynamically change path of strong name key file in windows form

Posted on 2006-10-23
7
217 Views
Last Modified: 2012-05-05
Using .net 1.1, windows forms

I created an assembly/dll and placed it in the global assembly cache. In the assemblyInfo file I have to put the path to the strong name key file like so:

<Assembly: AssemblyKeyFile("C:\My Documents\MyDll\bin\MyDll.snk")>

How can I dynamically set this path at runtime?

Thanks

San
0
Comment
Question by:Sanmarie
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:DjDezmond
ID: 17789443
What will decide what the path will be?

You can set a global variable, and whenever your app knows what the path will be, set it to that?

Or will that file 'follow' your app wherever its installed? if so, you can use 'application.startuppath'
0
 

Author Comment

by:Sanmarie
ID: 17789574

The problem was when I created the strong name key, I set the path to it on my machine. When my co-worker installed it, he got an error saying key not found because he didn't have the path set up.

I want the path to be independent of the machine. I just don't know how to go about it. How do I use application.startuppath?

Thanks

San
0
 
LVL 9

Accepted Solution

by:
DjDezmond earned 500 total points
ID: 17789890
Application.StartupPath = the path the executable is run from.

If your exe is in C:\MyApp\ and the DLL is in c:\YourApp\Dll then you would use:

Application.StartupPath & "\Dll\MyDll.snk"

And it would equate to:

C:\YourApp\Dll\MyDll.snk

It wouldn't matter what machine your using, or where the exe path is, as long as your DLL is always in the DLL directory of your Application directory (if that makes sense!?)
0
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

 
LVL 9

Expert Comment

by:DjDezmond
ID: 17789895
sorry... C:\MyApp and C:\YourApp were meant to be the same directory... typo there lol
0
 

Author Comment

by:Sanmarie
ID: 17790490

Thanks

I will try it out later and post a new question if any doubts
0
 
LVL 9

Expert Comment

by:DjDezmond
ID: 17794280
If you have any doubts/queries... just post in this thread. Ill carry on answering until its working.

Dez
0
 

Author Comment

by:Sanmarie
ID: 17795531

Will do today if any problems.

Thanks

San
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

21 Experts available now in Live!

Get 1:1 Help Now