简体   繁体   中英

Shortcut (.lnk) files in Visual Studio Solution Explorer

If I drag in the actual Excel file, it makes a copy of it in the folder and then I can double click it open it in Excel. It shows the little Excel Logo in Visual Studio. Great!!

I am also able to add a shortcut to a file in my solution explorer in Visual Studio. It shows. Example.lnk with a white file. It would be nice if it was smart enough to show the Excel icon. But that's the least of my problems.

If I double click it, it opens the shortcut in Hex. Great if I want to actually edit the shortcut itself, however, no so great when I want to use these tables of data as references with my code. And not have to sync changes between original and the copy Visual Studio enjoys making.

Is there a way to tell Visual Studio to follow the shortcut?

Thanks!

I worked around this issue by creating a small .exe.

class Program
{
    static void Main(string[] args)
    {
        if(args.Count() > 1)
        {
            Process.Start(args[1]);
        }
    }
}

Then in Visual Studio, right click any .lnk file and pick Open Width. Add this .exe to the list. For arguments put in "$(ItemPath)".

Select application in the listbox and click set as default.

From this point forward any .lnk on the tree will use this program follow the .lnk.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM