I have desktop application and want to convert it to an uwp application.
I use desktop app converter with powershell.
I am trying to convert my startup projects exe, but everytime i try execution stops at
Running Installer in Isolated Environment
VERBOSE: No installer valid exit codes specified. Using defaults: 0
VERBOSE: Replace any occurence of in -InstallerArguments
with C:\installer\logs VERBOSE: Running installer command in isolated
environment: VERBOSE: Command Line =
"C:\installer\X.Framework.Main.exe" /passive
part. Is the exe i try to convert is wrong or -InstallerArgument i write? What should i change to end the conversion succesfully?
My PowerShell command:
PS C:\Users\EccE\Desktop\convert> .\DesktopAppConverter.ps1 -Installer
C:\Users\EccE\Desktop\X\X-wpf-framework\bin\Debug\X.Framework.Main.exe
-InstallerArguments "/passive" -Destination C:\Users\EccE\Desktop\X\X-out\ -PackageName "XApp"
-Publisher "CN=X" -Version 0.0.0.1 -MakeAppx -Verbose
Edit:
When i tried to convert project solution i got the following error:
Running Installer in Isolated Environment
VERBOSE: No installer valid exit codes specified. Using defaults: 0
VERBOSE: Replace any occurence of in -InstallerArguments
with C:\installer\logs VERBOSE: Running installer command in isolated
environment: VERBOSE: Command Line =
"C:\installer\X.Framework.sln" /passive VERBOSE: Moving any logs
in
C:\DesktopAppConverter\e931cac0-58a1-46dc-9efd-f5f442a0d814\shared\logs
to C:\DesktopAppConverter\e931cac0-58a1-46dc-9efd-f5f442a0d814\logs
VERBOSE: Cleaning up by removing isolated environment shared folder
'C:\DesktopAppConverter\e931cac0-58a1-46dc-9efd-f5f442a0d814\shared'
VERBOSE: An error occurred. Refer to logs in
C:\DesktopAppConverter\e931cac0-58a1-46dc-9efd-f5f442a0d814\logs
Exception calling "RunIsolatedProcessWithMappedDirectoryAndExport"
with "6" argument(s): " geçerli bir Win32 uygulaması değil. (HRESULT
özel durum döndürdü: 0x800700C1)" At
C:\Users\EccE\Desktop\convert\converter_util\Sequencer.ps1:141 char:9
+ $installerExitCode = [Microsoft.Centennial.Tools.DesktopAppCo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : BadImageFormatException
VERBOSE: No installer valid exit codes specified
This is due to we need to package our executable program as a installer first, this converter can run your desktop installers through the converter in an unattended (silent) mode and obtain an AppX package that you can install by using the Add-AppxPackage PowerShell cmdlet on your development machine.
See the first paragraph in this document: Desktop App Converter Preview (Project Centennial)
See also the points of Preparing your desktop app for conversion to UWP
Your app installation requires user interaction. Your app installer must be able to run silently, and it must install all of its prerequisites that aren't on by default on a clean OS image.
You can create a MSI package and use converter to generate Appx as you want.
Related
I am trying to run the Batch file which runs the SSIS package. The SSIS package call the PowerShell script to fetch the data from different servers. I am able to get the SSIS package working without any error. But whenever I try to run the batch file which calls the SSIS package, it fails with below error:
import-module : The specified module 'failoverclusters' was not loaded because no valid module file was found in any
module directory.
At E:\XYZ\SSISPckg\Hypv\BASE\XYZ70GTNPENG003.ps1:6 char:1
+ import-module failoverclusters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (failoverclusters:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
The term 'Get-ClusterGroup' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
no vms in XYZ70GTNPENG003
Microsoft (R) SQL Server Execute Package Utility
Version 15.0.4223.1 for 32-bit
Copyright (C) 2019 Microsoft. All rights reserved.
I did not get such error when I executed the PowerShell script from SSIS.
I was able to identify FailoverClusters module in powershell folder. I was able to locate it by running Get-Module -ListAvailable command.
I have already executed Install-WindowsFeature "RSAT-Clustering-Powershell" to install the required module. Except this module, I was able to import the other Hyper-V module.
So, can someone please help with understanding where I am making mistake. I am able to run the SSIS package which calls the powershell script using Execute Process Task. But if I call the batch file which run the SSIS package, it fails with above error.
The issue is that the FailoverClusters module is only available from the x64 bit version of PowerShell. e.g. when you are opening PowerShell by yourself, it by default, opens the x64 bit version of PowerShell, and hence, is why your testing works. A 32 bit x86 version of the FailoverClusters module does not exist, and can't be run from a 32 bit environment.
You can see this is the case when you launch Windows PowerShell (x86) and try to load the module:
PS C:\> Import-Module failoverclusters
Import-Module : The specified module 'failoverclusters' was not loaded because no valid module file was found in any
module directory.
At line:1 char:1
+ Import-Module failoverclusters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (failoverclusters:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
When running SSIS packages from a .bat file, it defaults to the x86 version, which will launch the 32-bit x86 version of PowerShell, and hence, will throw the error message.
What you have to do is in your .bat file, explicitly launch the SSIS package with the x64 version of DTExec.exe something like this:
& "C:\Program Files\Microsoft SQL Server\150\DTS\Binn\DTExec.exe" /FILE MyFile.dtsx
This will launch the x64 bit version of DTExec.exe which will in turn launch the x64 version of PowerShell, and make the FailoverClusters module available.
I have the following problem:
I try to get all uninstallable applications from the registry and use (gp 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*').DisplayName -Like '*' as command.
In the x86 version of Powershell it returns a list of the applications but in the x64 version I get this error:
PS C:\Users\simon> (gp 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*').DisplayName -Like '*'
gp : Die angegebene Umwandlung ist ungültig.
In Zeile:1 Zeichen:2
+ (gp 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*').Di ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-ItemProperty], InvalidCastException
+ FullyQualifiedErrorId : System.InvalidCastException,Microsoft.PowerShell.Commands.GetItemPropertyCommand
The gp command itself seems to work. Also the command above works in x64 Powershell on other systems.
What I've tried:
gp to verify the Powershell knows this command.
[intPtr]::size to check if its x86/x64
Reinstalled Powershell (via optionalfeatures.exe)
Installed a new .NET framework
Tried the commands on other systems (they work)
Run Powershell as admin
Changed the path (as env variable) for Powershell.exe (to use x86 as default, but this lead to other problems - nevermind)
I am out of ideas and also Google didn't get me further.
[SOLUTION]
I found out this error was caused by an invalid REG_DWORD-value for the property NoModify of a NetBeans installation in the registry.
I am using the standard TFS vNext build step to execute a PowerShell script. Inside the script I am trying to take advantage of some of the functions within the standard TFS Agent modules.
Listed here:
http://blog.majcica.com/2015/11/14/available-modules-for-tfs-2015-build-tasks/
I have seen the following two lines in many PowerShell scripts found in the build steps:
Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Internal"
Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Common"
I have tried to use the same lines in my script, however I get the error:
VERBOSE: Loading module from path
'C:\TFS2015-Agent\Agent1\agent\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.dll'.
Import-Module : Could not load file or assembly 'Microsoft.TeamFoundation.DistributedTask.Agent.Interfaces, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.
At C:\tfsVnBw1\3\s\Configuration\BuildScripts\CommonFunctions.ps1:25 char:5
+ Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Common" - Error ... + CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
If I try not to import, it writes something like:
The 'Find-Files' command was found in the module 'Microsoft.TeamFoundation.DistributedTask.Task.Common',
but the module could not be loaded. For more information, run 'Import-Module Microsoft.TeamFoundation.DistributedTask.Task.Common'.
At C:\tfsVnBw1\3\s\Configuration\BuildScripts\CommonFunctions.ps1:71 char:16
+ $files = #(FindFiles $filePattern)
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Find-Files:String) [FindFiles], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Is it not possible to use the Modules from 'normal' PowerShell scripts and not only from PowerShell scripts registered as an actual build step?
Try to specify build agent’s module path, such as:
# Import the Task.Common and Task.Internal dll that has all the cmdlets we need for Build
$agentWorkerModulesPathRoot = "$($env:AGENT_HOMEDIRECTORY)\agent\worker"
$agentDistributedTaskInterfacesModulePath = "$agentWorkerModulesPathRoot\Microsoft.TeamFoundation.DistributedTask.Agent.Interfaces.dll"
$agentWorkerModulesPath = "$($env:AGENT_HOMEDIRECTORY)\agent\worker\Modules"
$agentDistributedTaskCommonModulePath = "$agentWorkerModulesPath\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.dll"
Write-Host "Importing VSTS Module $agentDistributedTaskInterfacesModulePath"
Import-Module $agentDistributedTaskInterfacesModulePath
Write-Host "Importing VSTS Module $agentDistributedTaskCommonModulePath"
Import-Module $agentDistributedTaskCommonModulePath
Is it not possible to use the Modules from 'normal' PowerShell scripts and not only from PowerShell scripts registered as an actual build step?
It is possible to have a PowerShell script in build step reference a module. I prefer to use the inline PowerShell task as it means I don't have to go through the rigmarole of gated check-in just to change the way the code is packaged. I use it quite often to do things like...
download a common assembly versioning ps1 script from a shared project in TFVC and execute it to stamp assemblies, nuget packages, etc with the build number.
change the build number
Save-Module for a module in a private PS repository, and include it in an artifact (install helpers)
Save-Module again to a temp folder, then import the module and use it to do something to the code being built.
Generate release notes or similar docs
... but you can use the regular "Run a PowerShell script" to do all these too.
Perhaps simpler though is to put the module in the path and update PowerShell if it's < 5.1, If you have PowerShell 3 or later on the build server, and the module is already installed on the server and in the agent account's $PSModulePath, then you don't even need to Import-Module, you can invoke the commands in that module directly.
We're running a Team City build server which already executes this script locally with no problem. However, when I try to run this script manually I have the following problem:
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.
PowerShell Community Extensions Imported.
PS C:\Users\user.domain> cd D:\pkg\platform-2b0c7e3f71f9-BUILD01; powershell.exe -noprofile -executionpolicy Bypass -file D:\pkg\platform-2b0c7e3f71f9-BUILD01\stage.ps1 production \\192.168.x.x\staging \\testserver.domain.com\staging
D:\pkg\platform-2b0c7e3f71f9-BUILD01
Start Staging: 12/15/2014 11:18:14
Verifying target environment configuration and staging targets
Copying source and environment switch
...
Verifying configuration files are valid XML files
Test-Xml : The 'Test-Xml' command was found in the module 'Pscx', but the module could not be loaded. For more information, run 'Import-Module Pscx'.
At D:\pkg\platform-2b0c7e3f71f9-BUILD01\stage.ps1:72 char:9
+ if (!(Test-Xml $file))
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-Xml:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
So I see the PowerShell Community Extenstions are getting imported (line 4) which makes me wonder what is going on. I am running the script as the exact same user that runs it under Team City. I've checked the build step I'm trying to replicate:
and I can't think of anything that I've missed (working directory option is set to the script file's directory). Any ideas would be appreciated...
Line 4 loads Pscx, Line 5 opens up a new powershell session with -NoProfile option, so it's unlikely that Pscx is loaded in that Powershell session.
I was trying to run a powershell script (which I have run before) and received the following error:Authorizationmanager Check Failed
I figured it was the Execution Policy, so ran:
Set-ExecutionPolicy Unrestricted
I then received:
Set-ExecutionPolicy : Initialization failure
At line:1 char:20
+ set-executionpolicy <<<< unrestricted
+ CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy], ManagementException
+ FullyQualifiedErrorId : System.Management.ManagementException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
The same initialization error occurs for Get-ExecutionPolicy
Some basic commands seem to work fine, such as:
Write-Output "hi"
Can anyone suggest a fix?
Note: This is on Windows XP
Update: If I run the contents of ascript from within the powershell command prompt, it works. I only get the errors if it is run as a script. Also, Get-ExecutionPolicy and Set-ExecutionPolicy still fail from within the powershell prompt.
Make sure you are running the console as admin [Right click] then [click] "run as administrator" when you run Set-ExecutionPolicy Unrestricted.
The source of the error was due to a problem with the WMI repository. I was able to repair the repository running the following command:
Note: This is for Windows XP
rundll32 wbemupgd, UpgradeRepository
Once this was run, I was successfully able to execute Get-ExecutionPolicy, and other powershell scripts again.
A couple of links that detail repairing the WMI Repository.
Another very common case (I think this only applies post-XP), is where the .ps1 file has been 'blocked' after being downloaded from an untrusted location.
Solution: open the 'Properties' of the file in Windows Explorer, and on the 'General' tab click 'Unblock', then 'Apply' or 'OK'.
Another potential reason for this error (seen on Windows Server 2012) is that the Windows Management Instrumentation service is not running.
Starting and running the service allows for Get-ExecutionPolicy to run, and then Set-ExecutionPolicy.