views:

102

answers:

3

Very simple Winforms application I want to deploy manually. Can all the referenced assemblies simply go in the application folder or where should they be published? (In ASP.NET they can go in the \bin folder). I would rather not put in the GAC.

+5  A: 

By default I place the referenced assemblies in the same folder I deploy the app to (or \bin for ASP.NET), barring a Very Good Reason to deploy to the GAC.

Eric J.
A: 

Eric J's answer is probably the correct one, but there is a reason to be wary of placing the assemblies in the application folder: Windows 7. I haven't run into this problem personally, since I'm still in Vista Hell, but apparently in Windows 7 the Protected Administrator account (which you normally run under) doesn't have write access to all application folders - it only has write access to application folders that were installed by that user. So if your application was installed by a Windows XP or Vista user, and then that user upgrades to Windows 7, your default Protected Admin user will be denied write permission on the application folder (since it has a different SID under the new version of Windows).

This problem would only affect you if you try to upgrade the dependent assemblies, and it would only affect users who installed your application under an earlier version of Windows and then upgraded to Windows 7, so I don't know how big a deal this would be for you.

See this article for more details.

MusiGenesis
You generally don't have write access to Program Files under Vista either. Am I missing the point?
Eric J.
@Eric J: I didn't realize that Vista did this, too (I set myself up as a normal Administrator right from the start). I thought I already hated Vista as much as was humanly possible, but I was wrong.
MusiGenesis
+1  A: 

You can use .NET probind to define a relative folder where the application should search .dlls at start. You only need to add a simple config file with your application. For simple apps, I deploy the executable and the config file in the root directory, and place the needed libraries in a lib subdirectory:

/
|-MyApp.exe
|.MyApp.exe.config
|-lib
   |-Lib1.dll
   |-Lib2.dll

Use this link from a recent anwer to find out how to create the config file

Ricky AH