locked
Where to put an .ico file so that is in application folder... RRS feed

  • Question

  • Hi,

    for my 2 Tier desktop app a need to have a .ico file for my shortcut (I call my app from a network share with a shortcut where I need this icon)

    I want to include this because I somethimes forget the icon to copy by hand.

    where to put the icon in my project so that it is avalible in the published folder?

    robert

    Thursday, December 13, 2012 4:57 PM

Answers

  • Hey Robert

    Not exactly clear on what you are asking for but here is something that may address what you are asking (Got some help for this from one of my LS team members that knows this space well - thanks Mike).

    Step1.  Change to "File View" of the solution explorer

    Step 2.  Right click on the main LS project node and "Unload Project" 

    Step 3.  Right click on the LS project node and select "Edit ...." so you can manually edit the .lsproj file

    Step 4.  In the editor, go to the bottom and add the following just above ending </Project> element.  Note that this assumes the icon file "myicon.ico" is located on disk at same folder as the .lsproj file. This will now allow you to include this icon file as part of the lsproj file too and can be checked into SCC if applicable. The "Target" element is the trick here to get it directly into the "publish" folder location. 

      <ItemGroup>
        <None Include="myicon.ico">
          <SubType>Content</SubType>
        </None>
      </ItemGroup>
      <Target Name="AfterPublish">
        <Copy SourceFiles="myicon.ico" DestinationFolder="$(PublishLocation)" />
      </Target>

    Step5.  Save changes to the lsproj file and close it..

    Step6.  Reload the project in solution explorer. Notice now that the myicon.ico file is seen in the file view only at the main LS project.

    Step7.  Publish...

    Hope this gets what you want.


    Robert Schoen (Microsoft Visual Studio LightSwitch Team)

    • Proposed as answer by Robert Schoen [MSFT] Thursday, December 13, 2012 6:34 PM
    • Marked as answer by Mad Rian Thursday, December 13, 2012 7:11 PM
    Thursday, December 13, 2012 6:33 PM

All replies

  • Hey Robert

    Not exactly clear on what you are asking for but here is something that may address what you are asking (Got some help for this from one of my LS team members that knows this space well - thanks Mike).

    Step1.  Change to "File View" of the solution explorer

    Step 2.  Right click on the main LS project node and "Unload Project" 

    Step 3.  Right click on the LS project node and select "Edit ...." so you can manually edit the .lsproj file

    Step 4.  In the editor, go to the bottom and add the following just above ending </Project> element.  Note that this assumes the icon file "myicon.ico" is located on disk at same folder as the .lsproj file. This will now allow you to include this icon file as part of the lsproj file too and can be checked into SCC if applicable. The "Target" element is the trick here to get it directly into the "publish" folder location. 

      <ItemGroup>
        <None Include="myicon.ico">
          <SubType>Content</SubType>
        </None>
      </ItemGroup>
      <Target Name="AfterPublish">
        <Copy SourceFiles="myicon.ico" DestinationFolder="$(PublishLocation)" />
      </Target>

    Step5.  Save changes to the lsproj file and close it..

    Step6.  Reload the project in solution explorer. Notice now that the myicon.ico file is seen in the file view only at the main LS project.

    Step7.  Publish...

    Hope this gets what you want.


    Robert Schoen (Microsoft Visual Studio LightSwitch Team)

    • Proposed as answer by Robert Schoen [MSFT] Thursday, December 13, 2012 6:34 PM
    • Marked as answer by Mad Rian Thursday, December 13, 2012 7:11 PM
    Thursday, December 13, 2012 6:33 PM
  • Hi Robert,

    Thank 's - it works - I have only changed the DestinationFolder="$(PublishLocation)\Application Files"

    robert


    • Edited by Mad Rian Thursday, December 13, 2012 7:11 PM
    Thursday, December 13, 2012 7:10 PM
  • Hi Robert/Robert,

    There's another (maybe simpler?) method, that I use for all my OOB applications.

    Creating a Start Menu icon for OOB application


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, December 14, 2012 4:58 AM
    Moderator
  • I create the shortcuts with GPO for specific user group so I need the ico file in the Application Files folder...

    robert

    Friday, December 14, 2012 8:28 AM