rraab
Posts: 1
Joined: Fri Aug 16, 2019 7:47 pm

PowerShell COM API folder sync path issue

I have a simple PowerShell Script to open an existing AI project, update the version number (from a Node.js project file), and build it:

Code: Select all

$projObject = Get-Content .\package.json | Out-String | ConvertFrom-Json;
$projName = "<private>";
$PROJDIR = "$($env:HOMEDRIVE)\$($env:HOMEPATH)/Documents/Advanced Installer/Projects/$projName";

$advinst = New-Object -ComObject AdvancedInstaller
$project = $advinst.LoadProject("$PROJDIR/$projName.aip")
$project.ProductDetails.Version = $projObject.version
$project.Save();
$project.Build()
However when I run it, I get the error:

Code: Select all

 ERROR:
The source folder
"Users\Users\Users\Users\Users\Users\Users\..\..\Code\Node\<snip>\bin\signatech-manager-2-win32-x64" of
the synchronized folder "APPDIR" is missing from disk. You need to either recreate the source folder path or reset the
synchronization from the "Folder Properties" dialog, in "Synchronize" tab.

At C:\Users\<snip>\Documents\Code\Node\<snip>\buid_inst.ps1:9 char:1
+ $project.Build()
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Is there something I can change in the Folders property on the Project object that will change the location the files are being sourced from? I tried setting

Code: Select all

$project.PredefinedFolders.ApplicationFolder.FullPath
but that gives an error on the number of arguments.
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: PowerShell COM API folder sync path issue

Hello and welcome to Advanced Installer forums,

The %homedrive% environment variable is resolved to this:

C:

while the %homepath% environment variable is resolved to something like (C: is on my machine) this:

\Users\<username>

From what I can see, your whole path is resolved to this:

C:\\Users\<username>/Documents/Advanced Installer/Projects/$projName

which is quite wrong.

In what regards the error that you receive, it seems that, in your project, you have a synchronized folder that does not exist on the disk. To avoid such an error, please create the folder on the disk or simply remove the "Synchronized folder" flag from your folder.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”