Reputation: 11502
Is there a way to detect and add to an innosetup script the dependencies of a >NET executable? Let's say I have a.exe and b.dll. c.dll in my solution, because a.exe is using those dlls. Is there a tool that can look at the executable and add b.dll and c.dll to the script as files?
Upvotes: 2
Views: 2048
Reputation: 13075
Usually the dependencies of a .NET app are the DLLs that VS already copied into the output folder, plus the framework itself. So it's easy to catch all non-framework dependencies with a simple:
[Files]
Source: bin\Release\MyApp.exe; DestDir: {app}; Flags: ignoreversion
Source: bin\Release\*.dll; DestDir: {app}; Flags: ignoreversion
Typically you don't need anything more complex unless you also depend on native or COM libraries, which don't get copied automatically -- but you should already know what those are.
Upvotes: 5
Reputation: 5472
There is no tool for this in Inno Setup - it looks more like programming job (C#...) than Inno scripting.
Maybe there is some (3rd party) extension which can do this? For example see this topic: How to find all dependencies of a .NET project?
Reflector (also Dependency Walker) works on compiled .exe file but you need to do this on the fly so this is my idea:
Create simple tool which loads your .csproj file and read the References node.
References are saved as this (CRefDll is C language project, dotNetDll is .net Library) :
<ProjectReference Include="..\CRefDll\CRefDll.vcxproj">
<Project>{26BB3110-CF72-4A1A-B1AC-1ADA0CCE41C4}</Project>
<Name>CRefDll</Name>
</ProjectReference>
<ProjectReference Include="..\dotNetDll\dotNetDll.csproj">
<Project>{14A56846-4ADA-421D-9F49-380CA20A7A63}</Project>
<Name>dotNetDll</Name>
</ProjectReference>
So the tool should load all elements in this node (files CRefDll.vcxproj and dotNetDll.csproj) and simply get correct output (with path) from them (using dotNetDll sometimes is not enough).
If I misunderstood your question and you need to detect and install .net Framework from Inno Setup it is not problem (and it is pretty easy) but your description look little different.
Upvotes: 2