0

Environment: WPF, .NET 4.0, VS 2010

I am developing an application which has one main app that will internally invoke sub application and the solution structure (mentioned only the required projects for simplicity) is as below:

Solution.sln
    MainApp (WPF application)
    SubApp (wpf application)
    Assets (class library)

I have added reference to the Assets project into MainApp and SubApp. I added Setup project and:

  1. Added MainApp primary output (this detects Assets.dll as a dependency).
  2. Created a folder SubApp (right click Application Folder and add new folder) and added SubApp primary output inside this folder). This too detects Assets.dll as dependency (which is correct!)

When I build the setup project, run the MSI and install the application, I see target application folder (c:\program files\default company) structure as below:

MainApp
   - MainApp.exe
   - Assets.dll
   - SubApp (folder)
        - SubApp.exe
        - Assets.dll (I don't want this to appear here simply because there will be SubApp1, SubApp2 and so on in future who all will refer to the same assets dll)

How can this be achieved? I am sorry if question has become too long but I believe in explaining things in one shot than to provide information in bits and pieces.

Nikhil Vartak
  • 5,002
  • 3
  • 26
  • 32
  • Assets goes in the GAC. –  Nov 27 '13 at 19:35
  • Can putting assembly into GAC be avoided? If I don't want to put it in GAC, is there any alternative approach? – Nikhil Vartak Nov 27 '13 at 21:28
  • Not trivially. You'd have to override assembly lookups in the domain within `SubApp` and manually load the assembly from the parent directory. –  Nov 29 '13 at 19:35
  • Only 15 views and 2 comments in 12 days, unbelievable for SO. Any extra efforts that post author has to take in order make it reach maximum people!? – Nikhil Vartak Dec 10 '13 at 11:08
  • Well, if you had 75 rep you could start a [bounty](http://stackoverflow.com/help/privileges/set-bounties). Honestly, I gave you the answer in comments. Either throw it in the gac (this is the best option, btw) or attach a listener to the [AssemblyResolve event](http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve(v=vs.110).aspx) and load your assemblies manually. –  Dec 10 '13 at 13:46

0 Answers0