dahall / Vanara

A set of .NET libraries for Windows implementing PInvoke calls to many native Windows APIs with supporting wrappers.
MIT License
1.81k stars 196 forks source link

The file generated by ShellLink.Create() is not a shortcut file. #457

Closed fishnet37222 closed 7 months ago

fishnet37222 commented 7 months ago

Describe the bug and how to reproduce

When I execute ShellLink.Create() a file is created, but File Explorer does not show it as a shortcut and viewing its properties does not show any of the tabs shown in the properties dialog for a shortcut file.

What code is involved

Here is a small console-based project that reproduces the issue. ShellLinkTest.zip

Expected behavior

I expect a valid shortcut file to be created.

Screenshots

ShellLinkTest was created using this project. ShellLinkTest2 was created using Windows itself. image image image

fishnet37222 commented 7 months ago

I just realized I wasn't including ".lnk" in the filename for the shortcut. Adding that fixed the issue.