locked
Publish project without the folder named application files RRS feed

  • Question

  • I have created a project using C# , window form application. 

    I have publish it, and some files are created.

    1. setup.exe

    2. myapplication.application

    3. Application files

    How can i hide the application file and make the exe standalone? I have tried to set password. but by doing that, the exe cant work.

    • Moved by Caillen Monday, February 9, 2015 9:52 AM
    Saturday, February 7, 2015 6:59 AM

Answers

  • That's just how windows forms works.

    You don't explain, but I guess you want to hide them because you have passwords or something in config files.

    You could put somewhat sensitive data in isolatedstorage.

    http://www.codeproject.com/Articles/28179/Use-of-Isolated-Storage-A-Simple-Demo

    That goes in appdata, which is a hidden folder.

    Most users won't even be aware they have an appdata folder.

    You could encrypt passwords or whatever in app.config.

    //call: ProtectSection("appSettings","DataProtectionConfigurationProvider"); 
    private void ProtectSection(string sectionName, string provider) 
    { 
        Configuration config = 
            WebConfigurationManager. 
                OpenWebConfiguration(Request.ApplicationPath); 
    
        ConfigurationSection section = config.GetSection(sectionName); 
    
        if (section != null && !section.SectionInformation.IsProtected) 
        { 
            section.SectionInformation.ProtectSection(provider); 
            config.Save(); 
        } 
    } 
    
    //call: UnProtectSection("appSettings"); 
    private void UnProtectSection(string sectionName) 
    { 
        Configuration config = 
            WebConfigurationManager. 
                OpenWebConfiguration(Request.ApplicationPath); 
    
        ConfigurationSection section = config.GetSection(sectionName); 
    
        if (section != null && section.SectionInformation.IsProtected) 
        { 
            section.SectionInformation.UnprotectSection(); 
            config.Save(); 
        } 
    } 

    http://stackoverflow.com/questions/3194040/how-to-encrypt-a-portion-of-appconfig-file-in-any-win-form-application

    http://stackoverflow.com/questions/1392876/encrypting-passwords-in-winforms-app-config-net

    And of course you could have a dummy app.config which looks like it's used but put the real passwords in isolated storage.

    But really, your best bet is to use windows authentication for any database access and not have any sensitive data in config files.


    Hope that helps.
    Recent Technet articles: Property List Editing ;   Dynamic XAML

    • Proposed as answer by Carl Cai Tuesday, February 10, 2015 6:25 AM
    • Marked as answer by Carl Cai Sunday, February 15, 2015 2:43 AM
    Saturday, February 7, 2015 9:02 AM
  • The files in the in the ApplicationFiles directory - the assemblies and the manifests - are a significant part of the information that describes a ClickOnce deployment. You cannot remove these files or make the "make the exe standalone".

    Please refer to the following page for more information about the ClickOnce deployment technology: https://msdn.microsoft.com/en-us/library/t71a733d.aspx

    Please also remember to mark all helpful posts as answer to close your threads.

    • Proposed as answer by Carl Cai Tuesday, February 10, 2015 6:25 AM
    • Marked as answer by Carl Cai Sunday, February 15, 2015 2:43 AM
    Saturday, February 7, 2015 11:04 AM
  • If you right-click on your project in the Solution Explorer and choose "Build" and then "Open Folder in File Explorer" and browse to bin/Debug or bin/Release you will see that there is a compiled .exe in there along with any required (.dll) assemblies.

    You can remove any other (.pdb, .vshost.exe and manfest files) and just keep the .exe.

    But note that if your application references any assemblies (.dll) that don't reside in the GAC you should not remove these.

    Please remember to mark all helpful posts as answer to close your threads and please start a new thread if you have a new question. Please don't ask several questions in the same thread.

    • Proposed as answer by Carl Cai Tuesday, February 10, 2015 6:25 AM
    • Marked as answer by Carl Cai Sunday, February 15, 2015 2:43 AM
    Saturday, February 7, 2015 2:56 PM
  • the application files, stores the images. 

    is there any way that i can hide the image folder? 

    Hello,

    What did you mean by "hide the image folder"?

    Did you mean making the folder's Hidden attribute enabled?

    Based on your original post and the replies, it seems that you want to create an application which just contains an exe file, right?

    If that is the case, I am afraid that doesn't make sense, because you said that application stores images, that means the application needs to be communicated with these files. Yes, we could hide them, but you still need to copy them to target machine, right?

    Regards,

    Carl


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    • Edited by Carl Cai Thursday, February 12, 2015 6:59 AM
    • Marked as answer by Carl Cai Sunday, February 15, 2015 2:43 AM
    Tuesday, February 10, 2015 6:25 AM

All replies

  • That's just how windows forms works.

    You don't explain, but I guess you want to hide them because you have passwords or something in config files.

    You could put somewhat sensitive data in isolatedstorage.

    http://www.codeproject.com/Articles/28179/Use-of-Isolated-Storage-A-Simple-Demo

    That goes in appdata, which is a hidden folder.

    Most users won't even be aware they have an appdata folder.

    You could encrypt passwords or whatever in app.config.

    //call: ProtectSection("appSettings","DataProtectionConfigurationProvider"); 
    private void ProtectSection(string sectionName, string provider) 
    { 
        Configuration config = 
            WebConfigurationManager. 
                OpenWebConfiguration(Request.ApplicationPath); 
    
        ConfigurationSection section = config.GetSection(sectionName); 
    
        if (section != null && !section.SectionInformation.IsProtected) 
        { 
            section.SectionInformation.ProtectSection(provider); 
            config.Save(); 
        } 
    } 
    
    //call: UnProtectSection("appSettings"); 
    private void UnProtectSection(string sectionName) 
    { 
        Configuration config = 
            WebConfigurationManager. 
                OpenWebConfiguration(Request.ApplicationPath); 
    
        ConfigurationSection section = config.GetSection(sectionName); 
    
        if (section != null && section.SectionInformation.IsProtected) 
        { 
            section.SectionInformation.UnprotectSection(); 
            config.Save(); 
        } 
    } 

    http://stackoverflow.com/questions/3194040/how-to-encrypt-a-portion-of-appconfig-file-in-any-win-form-application

    http://stackoverflow.com/questions/1392876/encrypting-passwords-in-winforms-app-config-net

    And of course you could have a dummy app.config which looks like it's used but put the real passwords in isolated storage.

    But really, your best bet is to use windows authentication for any database access and not have any sensitive data in config files.


    Hope that helps.
    Recent Technet articles: Property List Editing ;   Dynamic XAML

    • Proposed as answer by Carl Cai Tuesday, February 10, 2015 6:25 AM
    • Marked as answer by Carl Cai Sunday, February 15, 2015 2:43 AM
    Saturday, February 7, 2015 9:02 AM
  • The files in the in the ApplicationFiles directory - the assemblies and the manifests - are a significant part of the information that describes a ClickOnce deployment. You cannot remove these files or make the "make the exe standalone".

    Please refer to the following page for more information about the ClickOnce deployment technology: https://msdn.microsoft.com/en-us/library/t71a733d.aspx

    Please also remember to mark all helpful posts as answer to close your threads.

    • Proposed as answer by Carl Cai Tuesday, February 10, 2015 6:25 AM
    • Marked as answer by Carl Cai Sunday, February 15, 2015 2:43 AM
    Saturday, February 7, 2015 11:04 AM
  • is there anyway i can create an exe file without application files? 
    Saturday, February 7, 2015 2:49 PM
  • If you right-click on your project in the Solution Explorer and choose "Build" and then "Open Folder in File Explorer" and browse to bin/Debug or bin/Release you will see that there is a compiled .exe in there along with any required (.dll) assemblies.

    You can remove any other (.pdb, .vshost.exe and manfest files) and just keep the .exe.

    But note that if your application references any assemblies (.dll) that don't reside in the GAC you should not remove these.

    Please remember to mark all helpful posts as answer to close your threads and please start a new thread if you have a new question. Please don't ask several questions in the same thread.

    • Proposed as answer by Carl Cai Tuesday, February 10, 2015 6:25 AM
    • Marked as answer by Carl Cai Sunday, February 15, 2015 2:43 AM
    Saturday, February 7, 2015 2:56 PM
  • the application files, stores the images. 

    is there any way that i can hide the image folder? 

    Saturday, February 7, 2015 2:58 PM
  • the application files, stores the images. 

    is there any way that i can hide the image folder? 

    Hello,

    What did you mean by "hide the image folder"?

    Did you mean making the folder's Hidden attribute enabled?

    Based on your original post and the replies, it seems that you want to create an application which just contains an exe file, right?

    If that is the case, I am afraid that doesn't make sense, because you said that application stores images, that means the application needs to be communicated with these files. Yes, we could hide them, but you still need to copy them to target machine, right?

    Regards,

    Carl


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    • Edited by Carl Cai Thursday, February 12, 2015 6:59 AM
    • Marked as answer by Carl Cai Sunday, February 15, 2015 2:43 AM
    Tuesday, February 10, 2015 6:25 AM