How to embed a manifest - Visual Studios

时间:2019-04-08 14:04:24

标签: windows visual-studio manifest

I have an in-house Win-Forms app that takes a screenshot of itself. Under Windows 10 at DPIs other 100%, the screenshots were offset. The solution was to add a manifest declaring DPI awareness.

Everything I've found tells me that the manifest file should be embedded within the EXE, but Visual Studios 2017 creates a separate (application name).manifest file. If I copy both the executable and manifest to the local machine, running the application works fine. But if I only copy the executable, I get the same offset error as before. Apparently, the manifest is not embedded in the executable.

Futher, once I've run the executable without the separate manifest file present, copying the manifest file in no longer works. Apparently something is recording that this executable doesn't have a manifest file, so it no longer bothers to look for one. I have to rename some folder along the path before running the executable will make use of the manifest and act in a DPI-aware manner.

I have the app.manifest file under my project in the solution explorer. In Application Settings, I have "Icon and manifest" selected, with "app.manifest" as the Manifest choice. The app.manifest properties have "Do not copy" to Output directory. I found the "Build Action" was "None", but have also tried "Embedded Resource". Neither setting made a difference.

I would really prefer not to need a separate manifest file. Is there some setting I am missing that is causing the manifest to be external?

Also, if anyone knows what I can do to at least get the application to recognize a manifest file after it has once been run without one, without having to change the path, I would appreciate knowing that as well.

0 个答案:

没有答案