VS 2015 實測
public override void PreExecute() { base.PreExecute(); AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; } public ScriptMain() { // 放在這裡不會跑 //AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; } public Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { if (args.Name.Contains("DataEncrypt")) { var path = Variables.AssemblyPath; // 使用變數 return Assembly.LoadFile(System.IO.Path.Combine(path, "DataEncrypt.dll")); } return null; }Referencing a custom assembly inside a Script Task
Could not load file or assembly
沒有留言:
張貼留言