Solved

Difference Between Application Reference and Shortcut

Posted on 2007-11-24
3
3,360 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

Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

Question has a verified solution.

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

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
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 …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

895 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now