‘xx.dll’should be excluded because its source file ‘...’is under Windows System File Protection.

When using the Setup project in VS to package the exe, the normal process is: after adding the target exe (whether you choose to add files or add project output), the project will automatically copy the dependencies of the exe, that is, some dlls, to the target folder of the exe. As shown in the picture:

But if you encounter a warning like the title, it is always very uncomfortable, as shown in the figure:

Although the generation is successful, in order to avoid unnecessary problems, of course there may be some unexpected problems: https://www.add-in-express.com/forum/read.php?FID=5&TID=5524

How to find a way to eliminate the warning?

Method: For all the dlls reporting warning errors, enter the F4 property window and set the "Exclude" property to "True" , as shown in the figure

Or right-click the dll and select "Exclude" (the "Exclude" attribute is also set to "True" after exclusion, the same effect) , as shown in the figure:

In the middle, you may encounter such a situation:

Although the same generation is successful, it can be found that the above picture is due to the addition of a "System.Private.DataContractSerialization.dll" file, but its dependencies were not found. It is because we removed the system.xx.dll in the previous step. Personally, I don't think it needs to be considered, because as long as the .net framework environment is installed, these system assemblies can naturally be found under the shared assembly of the C drive. If there is no installation environment, the exe will naturally not be able to run, and naturally it will not be the turn of the dll to call the system assembly. (personal opinion)

The final result without error is as follows:

Guess you like

Origin blog.csdn.net/qq_23958061/article/details/117789861