Forum Discussion

hbatrnek's avatar
hbatrnek
Copper Contributor
Mar 13, 2020
Solved

MSIX application is not opening ReportViewer Microsoft.ReportViewer.WinForms

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.

  • hbatrnek's avatar
    hbatrnek
    Mar 16, 2020

    Tim Mangan 

     

    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.  🙂

23 Replies

  • hbatrnek's avatar
    hbatrnek
    Copper Contributor

    hbatrnek 

    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"
                      ]
                    }
                  ]
                }
              }
            }
          ]
        }
      ]
    }

     

    • 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.

      • hbatrnek's avatar
        hbatrnek
        Copper Contributor

        TIMOTHY_MANGAN 

        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?

         

Resources