6

Pretty much every time I go to build the setup project in my solution, I get the following error: "Invalid or unspecified target for shortcut". MSDN provides the following useless help. When I go to the dialog to (re-)select the target for the shortcut:

enter image description here

My primary output (for my main application) is not present, even though it is definitely listed in the File System view:

enter image description here

The setup project was deleted and completely re-created, and checked in. When it was checked back out, I got the exact same error.

I assume that whatever reason is causing the item to not show up in the "select target" dialog, is the same reason that the build is failing in the first place. What gives?

Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328

3 Answers3

8

I just solved this by changing my build mode from Debug to Release.

Primary Output for ... (Release x86) - It is looking for a release build of x86.

The iOSDev
  • 5,237
  • 7
  • 41
  • 78
TKramer
  • 96
  • 2
  • 1
    Yep that's what fixed it for me too. Can avoid that error by excluding the Setup project from the Debug build: right-click solution -> Configuration Manager, uncheck Build when 'Active solution configuration' dropdown is selected to Debug. – East of Nowhere Sep 18 '12 at 14:22
  • This was the problem for me too. Setting all of my items to (Active build) fixed it (after I fixed some configuration issues.) – Jonathon Reinhart Sep 26 '12 at 17:48
  • I had a similar fix, which resulted in the following change in the Setupvdproj file: OLD: "SourcePath" = "8:..\\FOO\\obj\\Debug\\netcoreapp3.1\\apphost.exe" NEW: "SourcePath" = "8:..\\FOO\\obj\\Debug\\netcoreapp3.1\\win-x86\\apphost.exe" not sure why but the win-x86 bit was newly needed since last week. My DevOps pipeline build didn't have any changes on my side to cause it. – Peter Drier May 27 '21 at 01:20
1

If you look at your Errors List you should see the error listed. Right click on it and choose the Properties Window. Find the "Target" property and simply set it to the correct value. This goes for the Icon problem as well.

Bill Kidd
  • 1,130
  • 11
  • 13
0

In my case, I was building and packaging a Net.Core project using a Publish Profile.

The publish was failing with no visible error during the Msi build.

I ran the publish profile manually and saw the error that I had 2 copies of appsettings.json being installed at the same location.

I excluded one of the files and both the Publish and Package completed successfully and the shortcuts became valid again.

Kuffs
  • 35,581
  • 10
  • 79
  • 92