Assembly not found? SA deleted it.
Uniwares_AS
Posts: 168
Ok, weird problem this one. Never seen that before, but here we go.
During my build process I get the error from SA that it could not find my assembly (which is built using VS2010, SA is invoked as a build task on AfterCompile).
Looking at the obj/Release folder, there is really no assembly, yet it must have been there because of the copy my build step makes before passing it to SA.
"Something" must have deleted it. Using process monitor it shows clearly that its SA processes the file, does actually a lot with it, and then deletes it. Right after it tries to reopen the file and throws the error.
The SA project file settings are identical as all the other projects i my solution which build just fine.
I do have a procmon dump if wanted.
During my build process I get the error from SA that it could not find my assembly (which is built using VS2010, SA is invoked as a build task on AfterCompile).
Looking at the obj/Release folder, there is really no assembly, yet it must have been there because of the copy my build step makes before passing it to SA.
"Something" must have deleted it. Using process monitor it shows clearly that its SA processes the file, does actually a lot with it, and then deletes it. Right after it tries to reopen the file and throws the error.
The SA project file settings are identical as all the other projects i my solution which build just fine.
I do have a procmon dump if wanted.
Comments
Its a bug in SA. But not in SA 5.0.
The .csproj file was still referencing the build task for SA 4.2 instead of SA 5.0 but the {sa}proj file already contained the updated keyfile password. As it seems, SA 4 does exit without warning before signing the assembly because it cant read the password of the keyfile or something like that.
I tried to repro it here:
* setting the old Password value in the {sa}proj file and building it with the MSBuild task for SA 4.2, works.
* new Password value (as used in SA 5) and building with the task for SA 4.2, deletes the file.
* new password value and build task for SA 5, works too.
I presume you are setting output to self.
SmartAssembly will delete the output file if it exists and then write out the new file. The signing is part of the write out step (rather than being a post build step) and as you've found if it can't open the strong name key because of a password decryption failure it will stop, leaving no file.
The failure should return a error code, I'll have a look into it and raise a bug if this is not the case.