Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-10-23
7
Medium Priority
?
225 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 1500 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

971 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