Replies: 1 comment
-
It is a good suggestion. At some point (a long time ago) I considered it and decided not to go with it unless there was a demand It was none at that time. The reason is the potential for side effects:
These reasons are still valid, but the benefit of the feature is too great to be ignored. So I implemented the method for auto referencing, but it is the user who needs to invoke it. You cannot use it yet as it will be only available in the next release. But you can easily test it by adding this tiny method to your codebase: project.AddCustomActionRefAssembliesOf(typeof(AnyTypeFromCustomActionAssembly));
...
public static void AddCustomActionRefAssembliesOf(this Project project, Type type)
{
var dependencies = type.Assembly
.GetReferencedAssemblies()
.Where(x => !x.Name.StartsWith("System"))
.Select(x =>
{
try
{
return System.Reflection.Assembly.Load(x).Location;
}
catch { return null; }
})
.Where(x => x.IsNotEmpty() && !x.StartsWith(Environment.SpecialFolder.Windows.GetPath(), true));
project.DefaultRefAssemblies.AddRange(dependencies);
} Nevertheless, I am happy to go further and implement conditional execution of this method for all managed actions during the build. So you you are keen and you can test this feature for your scenarios, please provide your feedback. |
Beta Was this translation helpful? Give feedback.
-
I think it would be nice to be able to reference dependencies and have them available during install?
I know you can include a custom action from a 3rd party dll, however in the case you additional information and want to have common, reusable code, you have e.g.:
I know you can share information through variables, however that produces additional clutter in the MSI and its less straightforward (lots of steps to setup).
I tried parsing the dll into a CA and loading it separately using e.g.
EmbeddedAssembly
, however that did not appear to do the correct initialization work to make it available at install time. I'm not sure we want to AOT compile it either, the binary could simply be stored in the Binary table, extracted and made available as an e.g. AnyCPU dll. I'm also not sure where the dlls should go...I know there is both a temp folder and a "secure folder".Beta Was this translation helpful? Give feedback.
All reactions