Unable to sign C ++ / CLI assembly in Visual Studio 2015

Using Visual Studio 2015 with Toolbox 2015: when I try to directly sign the assembly as follows:

C ++ / CLI assembly signing

Signing always occurs with the following error: LNK1346 ALINK operation failed (80040436) : Error signing assembly -- The process cannot access the file because it is being used by another process.

The same assembly can be signed in Visual Studio 2013 (I just updated it today).

Is this a known issue in 2015 (could not find errors finding this error)? Or am I doing something wrong?

EDIT: Workaround

This seems to be another McAfee AV error. However, there is another way to sign a file that McVirus can give enough time to release the lock that it took out.

The build may be delayed and sn -R $(TargetPath) $(LinkKeyFile) may be sn -R $(TargetPath) $(LinkKeyFile) as a post build event to complete the signing. This worked for me and @Moop.

+5
source share
1 answer

The process cannot access the file because it is being used by another process.

Works well on my machine, this is not a VS2015 problem. A common environmental issue, this error message is a standard tragedy on Windows computers that are infected with shrink malware.

Signing is a two-step process. The first link.exe file should generate the executable needed for the SHA256 hash to be computed for the file. Then the file is opened again by ALINK (managed by the linker) to add the signature. It must fight other processes that run on your machine that are also interested in the file. This type, which invariably gets its underwear in the kit when the executable file appears, it would seem, is nowhere, and insists on checking the contents of the file and excluding access to the file before it is completed.

Everything seems to work fine when you use a subscription delay, the delay is usually enough to force the process to complete its work and release the exclusive file lock. In addition, there are some chances that sn.exe is a little more complicated in this, try again to open the file periodically before giving up, ALINK, of course not.

You must make an exception in your antivirus product for your directory. If this is some kind of aggressive freeware such as Avast, AVG or ESET, then plan to get rid of it as soon as possible so that it can no longer bother you. The protector never bothers me.

+4
source

Source: https://habr.com/ru/post/1247683/


All Articles