Inno Setup Compiler "Cannot find the path specified" error with long paths

1,195 views
Skip to first unread message

Luiz Henrique Cassettari

unread,
Mar 10, 2022, 4:42:26 PM3/10/22
to innosetup
I'm trying to compile a .iss that has a source file that has a really big path (more than 260 characters).

By looking on the internet I found this: https://stackoverflow.com/questions/38789616/inno-setup-compiler-cannot-find-the-path-specified-error-with-long-paths

That explains a workaround to use a prefix the path with \\?\ (Microsoft article https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation).

The problem I'm having is I'm not able to add the prefix on the Files on the Source attribute.

I try to specify each file source path, but the compiler does not allow it to compile, saying No files found matching.

[Files]
Source: "\\?\Example\*"; DestDir: "\\?\{app}"; Flags: ignoreversion recursesubdirs;


There is a way to make the Source works with the \\?\ prefix?

Thanks.

Gavin Lambert

unread,
Mar 10, 2022, 7:07:12 PM3/10/22
to inno...@googlegroups.com
On 11/03/2022 10:42, Luiz Henrique Cassettari wrote:
> The problem I'm having is I'm not able to add the prefix on the Files on
> the Source attribute.
>
> I try to specify each file source path, but the compiler does not allow
> it to compile, saying No files found matching.
>
> [Files]
> Source: "\\?\Example\*"; DestDir: "\\?\{app}"; Flags: ignoreversion
> recursesubdirs;
>
> There is a way to make the Source works with the \\?\ prefix?

When you add the \\?\ prefix you must supply the full absolute path to
the file. Relative paths won't work.

You *might* be able to put that prefix in the SourceDir instead of in
each [Files] entry, letting those still use relative paths, but I
haven't tested that.

You shouldn't need the prefix in the DestDir. Avoid installing files to
a long path anyway, as it will cause problems with other software (and
perhaps your own as well).

Luiz Henrique Cassettari

unread,
Mar 10, 2022, 7:50:09 PM3/10/22
to innosetup
I tried the full path but the compiler threw some errors. (Using version 6.2.0)

I test the SourceDir and have the same error.

SourceDir=\\?\D:\Example\

innoerror.PNG

The \\?\ prefix on the DestDir is just to guarantee that the uninstall doesn't throw an error if the path was too long.

The idea is not to have a big path but I create automation to generate the exe files using the Nuke / InnoSetup.ScriptBuilder / Tools.InnoSetup and run and deploy using Github workflow.

Works fine but I was testing on a new C# project and I discover this issue if the project has a big name, at the moment I 'fix' moving the Inno Compilation to a temporary folder with a smaller SourceDir.

Kinda works but is not the most elegant solution.

Luiz Henrique Cassettari

unread,
Mar 10, 2022, 8:02:46 PM3/10/22
to innosetup
Reply all
Reply to author
Forward
0 new messages