We have found this problem long time ago, but now it is becoming a stuck problem.
When we compile again after we import an activity into Trident, it prompts "The target dll is being used, cannot be overwritten".
We have to close the Trident, then we can compile again.
After we review your codes, we found this line: "helper.ImportActivities(references, true)", and also we knew if we load an assmebly directly, this assembly is locked somewhere, even we have completed the process
if we call Assembly o = Assembly.Load(file); the file is actually is locked after the process.
Unless, we use the following code, load an assembly from an array of bytes.
using(FileStream fileStream = new FileStream(uniqueFilename, FileMode.Open, FileAccess.Read))
int length = (int)fileStream.Length; // get file length
buffer = new byte[length]; //
// actual number of bytes read
int sum = 0;
// total number of bytes read
// read until Read method returns 0 (end of the stream has been reached)
while ((count = fileStream.Read(buffer, sum, length - sum)) > 0)
sum += count; // sum is a buffer offset for next reading
Assembly o = Assembly.Load(buffer);
Is it possible for you to load the acitvity dll from bytes rather the file directly? or you have an alternative?