Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to get manifest file to work
Message
From
17/04/2020 07:17:32
 
 
To
17/04/2020 06:47:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01674070
Message ID:
01674075
Views:
63
>>>>Hi folks,
>>>>
>>>>I am trying to make a manifest file work, following the steps described by Rick Strahl (https://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=890)
>>>>
>>>>It sounds fairly simple, but for some reason it does not work. When I open the executable in ResourceHacker, I can only see the original default manifest embedded, but the custom app.exe.manifest file seems to get ignored completely. I wonder what I could be missing?
>>>
>>>Christian,
>>>
>>>I would advise you to check on two things: a) that your manifest file does not have other extension (like txt or xml); and b) it's placed in the same folder of your project (pjx) file.
>>
>>Also a small simple project does not work. Perhaps it has to do that I am compiling with VFP9 SP1. I will later try on SP2 on another machine.
>
>Christian,
>
>Here it is a self-contained test. You may try to run it. The message it should display is Assembly Identity name: vfp9.test.manifest. If not, then as you hinted your setup is not ready for manifest replacement.
>
>
>* tests manifest inclusion in a VFP9 executable
>
>* when the executable runs, it searches its own file for the
>* the assembly name
>
>LOCAL Source AS String
>LOCAL Manifest AS String
>LOCAL SafetyStatus AS String
>LOCAL DefaultStatus AS String
>LOCAL TempDir AS String
>
>m.DefaultStatus = SET("Directory")
>m.SafetyStatus = SET("Safety")
>
>SET SAFETY OFF
>
>* prepare the project folder
>* it can be safely emptied afterwards
>m.TempDir = ADDBS(SYS(2023)) + "vfp9-manifest"
>IF !DIRECTORY(m.TempDir)
>	MKDIR (m.TempDir)
>ENDIF
>
>SET DEFAULT TO (m.TempDir)
>
>* the executable program source
>TEXT TO m.Source NOSHOW
>
>	LOCAL Myself AS String
>	LOCAL Manifest AS String
>
>	m.Myself = FILETOSTR(_VFP.ServerName)
>
>	m.Manifest = STREXTRACT(m.Myself, "<?xml" + " version=", "</assembly>", 1, 4)
>	IF !EMPTY(m.Manifest)
>
>		LOCAL XML AS MSXML2.DOMDocument60
>
>		m.XML = CREATEOBJECT("MSXML2.DOMDocument.6.0")
>		m.XML.LoadXML(m.Manifest)
>
>		m.XML.Setproperty("SelectionNamespaces", "xmlns:ms='urn:schemas-microsoft-com:asm.v1'")
>
>		LOCAL AssemblyName AS String
>
>		m.AssemblyName = m.XML.Selectnodes("/ms:assembly/ms:assemblyIdentity/@name").item(0).text
>
>		MESSAGEBOX(TEXTMERGE("Assembly Identity name: <<m.AssemblyName>>"))
>
>	ELSE
>
>		MESSAGEBOX("Manifest not found...")
>
>	ENDIF
>
>ENDTEXT
>
>STRTOFILE(m.Source, "testexe.prg", 0)
>
>* create the manifest
>TEXT TO m.Manifest NOSHOW
><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
>	<assemblyIdentity 
>		version="1.0.0.0" 
>		type="win32" 
>		name="vfp9.test.manifest" 
>		processorArchitecture="x86"
>	/>
>	<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
>		<security>
>			<requestedPrivileges>
>				<requestedExecutionLevel level="asInvoker" /> 
>			</requestedPrivileges>
>		</security>
>	</trustInfo>
>	<dependency>
>	    <dependentAssembly>
>	        <assemblyIdentity
>	            type="win32"
>	            name="Microsoft.Windows.Common-Controls"
>	            version="6.0.0.0"
>	            language="*"
>	            processorArchitecture="x86"
>	            publicKeyToken="6595b64144ccf1df"
>	        />
>	    </dependentAssembly>
>	</dependency>
></assembly>
>ENDTEXT
>
>* save the manifest and put it close to the project, for linking
>STRTOFILE(m.Manifest, "testexe.exe.manifest", 0)
>
>* a project is built
>BUILD PROJECT "TestExe" FROM "testexe.prg"
>
>* and an executable, out of it
>BUILD EXE TestExe.exe FROM TestExe RECOMPILE
>
>* now, run the executable
>RUN /N TestExe.exe
>
>SET DEFAULT TO (m.DefaultStatus)
>IF m.SafetyStatus == "ON"
>	SET SAFETY ON
>ENDIF
>
Thanks for the code.
Indeed it does not include the manifest in my test, it shows "Microsoft.VisualFoxPro". So I will test the same later on the other machine. But this explains it already that I could not succeed here.
Christian Isberner
Software Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform