Mar 13 2020 04:18 AM
When I run the application exe file directly from C:\Program Files\WindowsApps it works, but not when I start it from the Start menu.
Process Monito is showing C:\WINDOWS\Microsoft.Net\assembly\GAC_32\Microsoft.ReportViewer.WinForms\v4.0_14.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WinForms.dll PATH NOT FOUND. NuGet package is Microsoft.ReportingServices.ReportViewerControl.Winforms. Why is he looking there when files are in an app directory? I am using .NET Framework 4.8 WPF and WindowsFormsHost for displaying the ReportViewer. From an explanation of how Package Support Framework works, I still don't know what exact steps should I take or if what process monitor shows is the root problem.
Mar 13 2020 04:57 AM
I've tried this https://docs.microsoft.com/en-us/windows/msix/psf/package-support-framework, application runs but the issue stays, it will not open window with the report viewer on it and it does not throw an exception.
Maybe the issue is in config.json, I am not sure how to configure it.
Package.appxmanifest:
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity
Name="a1ddc6e0-bb40-49b3-8e57-6a0646b7f49d"
Publisher="CN=TRUE IT, O=TRUE IT, C=HR"
Version="1.0.72.0" />
<Properties>
<DisplayName>SyriliumRiF</DisplayName>
<PublisherDisplayName>TRUE IT</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="PSFLauncher32.exe"
EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
DisplayName="SyriliumRiF"
Description="SyriliumRiF"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png" BackgroundColor="white">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" Square71x71Logo="Images\SmallTile.png" Square310x310Logo="Images\LargeTile.png" >
</uap:DefaultTile >
<uap:SplashScreen Image="Images\SplashScreen.png" />
<uap:LockScreen BadgeLogo="Images\BadgeLogo.png" Notification="badgeAndTileText"/>
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
config.json:
{
"applications": [
{
"id": "App",
"executable": "SyriliumRiF.exe",
"workingDirectory": "/"
}
],
"processes": [
{
"executable": "SyriliumRiF",
"fixups": [
{
"dll": "FileRedirectionFixup32.dll",
"config": {
"redirectedPaths": {
"packageRelative": [
{
"base": "/",
"patterns": [
".*\\.dll"
]
}
]
}
}
}
]
}
]
}
Mar 13 2020 07:57 AM
@hbatrnek For a dll not found issue, assuming the dll is in your package you should probably try adding DynamicLibraryFixup.
This fixup was developed to ensure the exe will find any dll inside the package, overcoming issues due to working directory, path variables not being supported, and AppPaths not being supported.
It may be included in addition to the FileRedirectionFixup.
Mar 13 2020 04:30 PM
I am sideloading my package, not through the store and I have an MSIX project with Package.appxmanifest file. The problem is no matter what I enter in this part (you can see the zulzu.exe file which does not exist):
<Applications>
<Application Id="App"
Executable="zulzu.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="SyriliumRiF"
Description="SyriliumRiF"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png" BackgroundColor="white">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" Square71x71Logo="Images\SmallTile.png" Square310x310Logo="Images\LargeTile.png" >
</uap:DefaultTile >
<uap:SplashScreen Image="Images\SplashScreen.png" />
<uap:LockScreen BadgeLogo="Images\BadgeLogo.png" Notification="badgeAndTileText"/>
</uap:VisualElements>
</Application>
</Applications>
the real exe starts normally, that is saying that PSFLauncher32.exe was never started when in Executable, but if I am to delete this whole Applications section the package complains so, this manifest file is being used but that Application part is ignored, why?
Mar 13 2020 08:36 PM
@hbatrnek It should be like this for MSIX:
EntryPoint="Windows.FullTrustApplication"
Mar 14 2020 03:42 AM - edited Mar 14 2020 04:29 AM
I've tried that and when I go to Publish > Create App Package on the Windows Application Package Project, he just overrides whatever I've entered in Application > Executable with the executable from the referenced project.
Package.appxmanifest:
<Applications>
<Application Id="App"
Executable="PsfLauncher32.exe"
EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
DisplayName="SyriliumRiF"
Description="SyriliumRiF"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png" BackgroundColor="white">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" Square71x71Logo="Images\SmallTile.png" Square310x310Logo="Images\LargeTile.png" >
</uap:DefaultTile >
<uap:SplashScreen Image="Images\SplashScreen.png" />
<uap:LockScreen BadgeLogo="Images\BadgeLogo.png" Notification="badgeAndTileText"/>
</uap:VisualElements>
</Application>
</Applications>
SyriliumRiF.MSIX_1.0.80.0_x86.appx oppened with MSIX Packaging Tool:
<Applications>
<Application Id="App" Executable="SyriliumRiF.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="SyriliumRiF" Description="SyriliumRiF" Square150x150Logo="Images\Square150x150Logo.png" Square44x44Logo="Images\Square44x44Logo.png" BackgroundColor="white">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" Square71x71Logo="Images\SmallTile.png" Square310x310Logo="Images\LargeTile.png"></uap:DefaultTile>
<uap:SplashScreen Image="Images\SplashScreen.png" />
<uap:LockScreen BadgeLogo="Images\BadgeLogo.png" Notification="badgeAndTileText" />
</uap:VisualElements>
</Application>
</Applications>
I don't know how to stop him from overriding what I've entered.
The solution that comes to mind is creating another executable project that I can reference and that starts the PsfLauncher32.exe, I'll try that.
Mar 14 2020 05:45 AM
@hbatrnek I don't build packages that way, so not sure I can help much. But bringing in PsfLauncher does require an extra field not present (ID) in your examples that PsfLauncher (not the building tools) requires. I'll show a working example below, but the value of ID is a munging of the name of the executable in uppercase, with exe dropped, and number characters converted to equivalent English string.
But here is a properly formed manifest that was created using the MSIX Packaging Tool (which I know isn't how you want to build your package). The example uses the 64 bit version of PsfLauncher. File paths in this example are different because I didn't put them at the root folder of the package, so you would not have the "VFS\…" file path in your references.
<!--Package created by MSIX Packaging Tool version: 1.2019.1220.0-->
<Identity ProcessorArchitecture="x64" Version="3.26.2.0" Publisher="CN=TMurgent.local" Name="FileZilla-Scripts10"/>
<Properties>
<DisplayName>FileZilla</DisplayName>
<PublisherDisplayName>FileZilla (Packaged by TMurgent)</PublisherDisplayName>
<Description>None</Description>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us"/>
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MaxVersionTested="10.0.18335.0" MinVersion="10.0.17763.0"/>
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust"/>
</Capabilities>
<Applications>
<Application EntryPoint="Windows.FullTrustApplication" Executable="VFS\ProgramFilesX64\FileZilla FTP Client\PsfLauncher1.exe" Id="PSFLAUNCHEROne">
<uap:VisualElements Description="FileZilla" Square44x44Logo="Assets\Square44x44Logo.png" Square150x150Logo="Assets\Square150x150Logo.png" DisplayName="FileZilla" BackgroundColor="transparent">
<uap:DefaultTile Square71x71Logo="Assets\Square71x71Logo.png" Square310x310Logo="Assets\Square310x310Logo.png" Wide310x150Logo="Assets\Wide310x150Logo.png"/>
</uap:VisualElements>
</Application>
</Applications>
</Package><!--Package created by MSIX Packaging Tool version: 1.2019.1220.0-->
Perhaps this can help you sort things out. I'm unfamiliar with the FWK file reference in your project example, but possibly your issue starts there.
Mar 14 2020 12:20 PM - edited Mar 14 2020 12:24 PM
This is my exe project that starts PsfLauncher32:
class Program
{
static void Main(string[] args)
{
Process.Start("PsfLauncher32.exe");
}
}
and this is the config.json:
{
"applications": [
{
"id": "App",
"executable": "SyriliumRiF.exe",
"workingDirectory": "/"
}
],
"processes": [
{
"executable": "SyriliumRiF",
"fixups": [
{
"dll": "FileRedirectionFixup32.dll",
"config": {
"redirectedPaths": {
"packageRelative": [
{
"base": "/",
"patterns": [
"*"
]
}
]
}
}
},
{
"dll": "TraceFixup32.dll",
"config": {
"traceLevels": {
"filesystem": "allFailures"
}
}
},
{
"dll": "DynamicLibraryFixup32.dll",
"config": {
"traceLevels": {
"filesystem": "allFailures"
}
}
}
]
}
]
}
Why is PsfLauncher32 not starting SyriliumRiF.exe?
Who is reading the config.json, is PsfLauncher32 reading it?
What parameters do I need to send to PsfLauncher32.exe, what would be the command line call?
Mar 14 2020 01:18 PM - edited Mar 14 2020 01:27 PM
@hbatrnek Perhaps you are missing PsfRuntime32.dll? I see you have the exe but we always use the dll.
Also: PsfLauncher, even the release build, will always output to the debug port. So run Sysinternals DebugView on the side to see what it might be telling you.
Mar 14 2020 01:26 PM
@hbatrnek wrote:
Who is reading the config.json, is PsfLauncher32 reading it?
@hbatrnek In the PsfLauncherXX.exe process, PsfRuntimeXX.dll will initially read the config.json file for the "applications" section at the top of the file. It is this runtime that will process the instructions for the matching application ID (based on process name munging mentioned previously).
When the PsfRuntime launches your target process, it injects another copy of PsfRuntime into that process. This secondary copy will re-read the config.json file for the purpose of handling the bottom half ("processes") to determine which other dlls to inject and provide those injected dlls with their configuration.
Mar 14 2020 01:39 PM - edited Mar 14 2020 01:41 PM
Sysinternals DebugView did not catch anything but in Event Viewer there is a record of an error:
"Faulting application name: PsfLauncher32.exe, version: 0.0.0.0, time stamp: 0x5e66e34c
Faulting module name: PsfRuntime32.dll, version: 0.0.0.0, time stamp: 0x5e66e338
Exception code: 0xc0000409
Fault offset: 0x00028bd1
Faulting process id: 0x5dc8
Faulting application start time: 0x01d5fa3f846ea6ca
Faulting application path: C:\Programming\SyriliumRiF\Main\SyriliumRiF.MSIX\bin\x86\Release\PsfLauncher32.exe
Faulting module path: C:\Programming\SyriliumRiF\Main\SyriliumRiF.MSIX\bin\x86\Release\PsfRuntime32.dll
Report Id: 1f39b072-5917-486f-abc1-21712ebdc372
Faulting package full name:
Faulting package-relative application ID: "
Mar 14 2020 01:45 PM - edited Mar 15 2020 03:56 AM
I am not missing anything, I've dumped everything you've got into the folder.
Sysinternals DebugView did not catch anything but in Event Viewer there is a record of an error.
I've also tried running it in safe mode.
"Faulting application name: PsfLauncher32.exe, version: 0.0.0.0, time stamp: 0x5e66e34c
Faulting module name: PsfRuntime32.dll, version: 0.0.0.0, time stamp: 0x5e66e338
Exception code: 0xc0000409
Fault offset: 0x00028bd1
Faulting process id: 0x5dc8
Faulting application start time: 0x01d5fa3f846ea6ca
Faulting application path: C:\Programming\SyriliumRiF\Main\SyriliumRiF.MSIX\bin\x86\Release\PsfLauncher32.exe
Faulting module path: C:\Programming\SyriliumRiF\Main\SyriliumRiF.MSIX\bin\x86\Release\PsfRuntime32.dll
Report Id: 1f39b072-5917-486f-abc1-21712ebdc372"
Mar 16 2020 06:02 AM - edited Mar 16 2020 06:08 AM
Does anyone know something about this error regarding PsfLauncher32.exe? I did not find any useful info.
Mar 16 2020 09:22 AM
@hbatrnek You may need to use a debugger to figure out what you are doing wrong. If you look in the WaitforDebugger code you'll find the lines to cause the wait. Add that into the attach code of PsfRuntime and then you can launch your app and then get your debugger to attach the process and walk through the issues.
Mar 16 2020 09:38 AM - edited Mar 16 2020 09:49 AM
What debugger, where? I am not a c++ dev. All I am doing is starting the exe file, it does not get simpler than that. I am double-clicking PsfLauncher32.exe with my left mouse button. ;) I've downloaded Microsoft.PackageSupportFramework.1.0.200309.6. The problem can't be in my solution or project because it's not being used, I've stripped it to bare bones. PsfLauncher32.exe should just start the exe file next to it, and it's not doing that. How do I debug PsfLauncher32.exe that starts and immediately ends?
Mar 16 2020 10:45 AM
@hbatrnek Sorry, I was assuming you were a dev. If you are not a dev you might want to build your package using a packaging tool instead of a developer build tool.
You might want to consider packaging by using the Microsoft MSIX Packaging Tool and PsfTooling. Both are free apps in the Microsoft Store. You use the Packaging Tool to capture your existing installer (or just copy files yourself). While you are still in monitoring mode after installing your app, you then run PsfTooling to inject the PSF for you. Alternatively, there are other third party packaging tools from Microsoft Partners that could be used.
Mar 16 2020 01:53 PM - edited Mar 16 2020 02:13 PM
I've managed to build the CentennialFixups solution and the first problem is that ::GetCurrentPackageFamilyName(&length, nullptr) == APPMODEL_ERROR_NO_PACKAGE
"The process has no package identity."
What other files or setup is he expecting?
I am really not keen on learning C++ just because of this program and MSIX Packaging Tool is not an option because I have my own solution in C# .NET Framework 4.8 that I want to be packaged and distributed. ;) What are the requirements of the PsfLauncher, is he expecting the MSIX package or what? Logic would say that PsfLauncher should first read the config.json to be able to find other files or packages if necessary which he is not doing because psf::is_packaged() returns false.
inline bool is_packaged() noexcept
{
UINT32 length = 0;
return ::GetCurrentPackageFamilyName(&length, nullptr) != APPMODEL_ERROR_NO_PACKAGE;
}
Mar 16 2020 02:39 PM - edited Mar 16 2020 02:50 PM
If I am to force that is_packaged == true then it returns error "Unable to read memory".
I presume that the program needs to be started from the windows start menu because then he is wrapped in that windows store package. I am going back to trying this in a packaged environment:
void attach()
{
psf::wait_for_debugger();
Mar 16 2020 03:34 PM - edited Mar 16 2020 03:37 PM
Now I realized that the packaged application default directory is c:\windows\system32 and that is why he is unable to Process.Start the exe in the project directory. "System.ComponentModel.Win32Exception: 'The system cannot find the file specified'". What am I supposed to do, is PsfLauncher unable to work with the Windows Application Packaging Project in Visual Studio?
When you do this:
he overrides PsfLauncher32.exe
<Applications>
<Application Id="SyriliumRiF"
Executable="PsfLauncher32.exe"
EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
DisplayName="SyriliumRiF"
Description="SyriliumRiF"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png" BackgroundColor="white">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" Square71x71Logo="Images\SmallTile.png" Square310x310Logo="Images\LargeTile.png" >
</uap:DefaultTile >
<uap:SplashScreen Image="Images\SplashScreen.png" />
<uap:LockScreen BadgeLogo="Images\BadgeLogo.png" Notification="badgeAndTileText"/>
</uap:VisualElements>
</Application>
</Applications>
with project's exe referenced in:
Was anyone able to solve this or it's unsolvable for the moment?
Did anyone try to solve this through Windows Application Packaging Project?
MSIX Packaging Tool seems crap to me because he is doing packaging by the principle of recording what program is doing and accessing, that is not what I want for my VS solution, for VS solution they've created a Windows Application Packaging Project, but maybe it's still in its infancy.
Mar 16 2020 03:56 PM
@hbatrnek To set the working directory to the root of the package folder, in the manifest use
WorkingDirectory = ""
Mar 16 2020 05:09 PM
Solution
I've resolved it with this:
Process.Start(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "PsfLauncher32.exe"));
The problem was in the root path when starting it from windows start, root path for Process.Start is not the application folder when started as a store package. :)