Solved

Difference Between Application Reference and Shortcut

Posted on 2007-11-24
3
3,384 Views
Last Modified: 2008-02-01
I have a VB.NET app using one click deployment. Since it will not create a desktop shortcut I got the bright idea to create one on program startup. The problem is the shortcut I create doesn’t do the check for updates that the one created in the start menu does.

I see that the one automatically created is of type “Application Reference” instead of a “Shortcut”. The “Application Reference” has a General and a Summary tab. The shortcut has a General, Shortcut and Compatibility tab.

Two questions:

1)      What is an “Application Reference” and how does it differ from a shortcut?
2)      How can I make the shortcut check for downloads?

I have tried goggling, but application and reference are not words conducive to search engines.

Thanks
Randy Miller
0
Comment
Question by:randymiller
  • 2
3 Comments
 
LVL 3

Expert Comment

by:ScottParker
ID: 20344357
In the Load routine of your main form put this code...
        Try
            copyShortcut("folderStartMenuShortcutIsIn", "NameOfProgram.appref-ms")
            If System.Deployment.Application.ApplicationDeployment.CurrentDeployment.IsFirstRun Then
                copyShortcut("folderStartMenuShortcutIsIn", "NameOfProgram.appref-ms")
            End If
        Catch ex As Deployment.Application.InvalidDeploymentException
            'this will always occur in debug mode. Also if user tries to run from the actual EXE
            MessageBox.Show("Please run this application from the shortcut in the Start Menu to get the automatic update feature working." & vbCrLf & vbCrLf & "You can create a desktop shortcut from that particular shortcut if you like.", "Alert")
           messagebox.show("Error with shortcut and InvalidDeploymentException")
            End
        Catch ex As Exception
            messagebox.show("Error with shortcut and InvalidDeploymentException")
            End
        End Try

Then add this function...
    Public Shared Sub copyShortcut(ByVal manufacturerName As String, ByVal shortcutFileName As String)
        'the easy way for VB programmers *
        Dim desktopPath As String = My.Computer.FileSystem.SpecialDirectories.Desktop + "\" + shortcutFileName
        Dim startPath As String = My.Computer.FileSystem.SpecialDirectories.Programs + "\" + manufacturerName + "\" + shortcutFileName
        Try
            System.IO.File.Copy(startPath, desktopPath, True)
        Catch e As Exception
            Throw e
        End Try
    End Sub
0
 

Author Comment

by:randymiller
ID: 20344428
Different approach, I like the idea.

Do you know what an "Applicatoin Reference" is?
0
 
LVL 3

Accepted Solution

by:
ScottParker earned 500 total points
ID: 20344467
the applciation reference is that "NameOfProgram.appref-ms" section.

The following link explains it better then I could.  (Even though its on a more advanced topic)

http://www.codeproject.com/useritems/ClickOnceLauncher.asp?df=100&forumid=308890&exp=0&select=1517755&tid=1513516
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Import a txt file into a DataGridView and TextBox 20 38
Help with converting xml file to excel using VB.NET 3 20
Problem to file 4 21
get combo value in class 5 8
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question