Change Published Project Install Directory in Windows8.1 - c#

I am trying to change the default installation directory of my projects when I publish them but I seem to have no choice over where the published setup.exe actually puts the program. It seems after setup.exe running and application installed, all the processed files are under the folder of C:\Users\{username}\AppData\Local\Apps\2.0\ (Something like that, I dont remember the exact directory as it is very long). This is not what i want as I installed the program in the C:\Program Files\ but all the log files go to the C:\Users\{username}\AppData\Local\Apps\2.0\. This is really really annoying.
The application I published is C# Windows Form Application
And I have looked through online and found that somebody suggested to create an MSI package for C# Windows Application Using a Visual Studio Setup Project instead of publishing the program:
Publish Windows form application how change the installation path
It is supposed that the above website can solve this problem. Are there any other suggestions to solve this redirection problem after publishing the C# Windows Form Application? Thank you.

When you use the Publish funtion in Visual Studio, you are creating click-once publication. This type of deployment has relatively fixed rules and not everything can be configured. It allways installs into an obfuscated folder under windows user profile. It is similar to the fact, that you cannot change location where windows-store modern apps are installed under Windows 8.1.
You can create MSI setup project for your app - but in Visual Studio 2012 this type of project is missing and it was re-introduced againg in Visuals Studio 2013. There you can specify install folder. You can also use Install Shield Lite with Visual Studio 2012.
You wrote:
This is not what i want as I installed the program in the C:\Program
Files\
It is not possible to install ClickOnce application using Publish button in Visual Studio into C:\Program Files\.
If you have just problem with the location of your log files, you need to specify a different folder within your application code. Make sure that user, who is running your app, has write access to that folder - it should be in some user's profile folder or in a public folder. Avoid %ProgramFiles% as a folder for your log files - it is not a good practice.
Instead of Application.StartupPath you should use path accessible to all users including non-admin, like:
Path.Combine(Environment.GetFolderPath(SpecialFolder.CommonApplicationData),"MyCompanyName")

You can use InstallShield to create installation wizards/Setup.
Here's the free version for Visual Studio

Related

Visual Studio Publish Installs Program But I Can't Find the Files

I have VS community edition and I can't find my installed files. I go to the properties window of my start up project and click down to Publish. My publishing folder location is j:\projectinstall. My installation folder is \c\program files (x86)\TestProject\ (For some reason, VS doesn't allow destinations such as c:\program files (x86)) I run publish then run the install on another workstation. Everything works fine -- I get a shortcut on the desktop and I double click it and the file runs. The problem is that it's like the files don't exist. I can't find file location, there is no target. I do a search on my hard drive and the files are just not there. Any help would be greatly appreciated. I tried it with VS 2015 and 2017.
I found the file under c:\users..\appdata\localapps... but I don't want it published into some buried folder. Please help.
The problem is that the VS Community Edition doesn't come with the proper tools to make an installer. I found a free installer program online: Inno Setup

How to give Administrator Privileges to my VSPackage?

I've developed a VSPackage for Visual Studio, which needs to copy some files to Visual Studio's Installation Path.
If I Run Visual Studio as Administrator (when using my installed VSPackage). It can copy files with no errors.
When I run Visual Studio normally, I get Access to the path ... is denied error.
Question
How can I give my VSPackage to admin privileges even when the Visual Studio is being run as a normal user.
Or at least how can I invoke something like this:
Your package is a .dll (loaded on a process), not an .exe (a process), and therefore it cannot have different privileges than its process (Visual Studio, that is, devenv.exe). What your package can do is to launch a different process with admin rights. See my article:
HOWTO: Launch a process with admin rights from a Visual Studio add-in on Windows Vista or higher.
That said, it is a very wrong approach to do this to copy files to the VS installation path. That should be done by the setup of your package (.msi), not by your package.
On the one hand, if it is done by the package once installed, the user could deny the elevation prompt and the files would not be copied and your installation would be incomplete. Can your package run properly without those files?
On the other hand, if the user denies the elevation prompt to install the package, it wouldn't be installed at all, which is a more clean approach.

How to log a project that is being deployed from Visual Studio?

I have a C# project written using Visual Studio Express 2013 for Windows Desktop. When I run the project in debug mode via Visual Studio (on Windows 8 Pro) it executes just fine, and so does copying the files out of the bin directory.
I need to deploy to a Windows 7 Embedded System with the correct version of .NET Framework. I tried:
copying the files over with the .dll and everythig from the bin folder and when starting I get no error, but doesn't start at all. I get no information at all.
tried the one click installer (choosing the option to install from dvd) and it seemed to install fine, but when I start it, I get same issue. Not starting, and no messages.
I also tried the Advanced Installer (free version) and when importing the visual studio project files it fails with the message "Failed to start Visual Studio. Error: Invalid Class String"
[UPDATE] Advanced Installer cannot import VS Express solutions because the API from VS that provides assistance on import is not available for VS Express edition. Only solutions created with paid editions of VS can be imported in Advanced Installer.
So how can I log or see what is happening to debug this?

How to Create Installer for my Project

Hi guys i have a c# project that i want to create an installer.I want the installer to do the following:
Copy all the files that my application is using to a user chosen path (copy the files to the chosen path).
Ask for a specific Path(my c# program requires Google Drive Application to be installed and need its path)
Create Folders and Text files in that Path.
Please help me guys thanks.
Project Setup & Install was dropped after Visual Studio 2010. You'll either have to go the WiX route, or if you have Visual Studio 2013, you can create an InstallShield Limited project. There are several alternatives as well, just do a search.
Here's a link to a page that gives a video walkthrough of how to create an application installer with InstallShield Limited from Visual Studio 2013:
http://learn.flexerasoftware.com/content/IS-EVAL-InstallShield-Limited-Edition-Visual-Studio

where to find Microsoft.VisualStudio.QualityTools.Resource.dll?

I am in the process to setup our new Win7 build machine for our C# project. We don't want to install Visual Studio on that machine. So I am following the instruction "Running mstest without Visual Studio" to setup our machine.
On step 3:
Put Microsoft.VisualStudio.QualityTools.Resource.dll and
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll in the GAC on the CIServer,
because that is where they are on the DevMachine.
On my develoopment machine (installed Visual Studio 2008 professional version) I found both of them in my GAC (C:\windows\assembly) but I searched my entire development machine and couldn't find the Microsoft.VisualStudio.QualityTools.Resource.dll
My questions are:
where to get the Microsoft.VisualStudio.QualityTools.Resource.dll?
can I copy above file from GAC? (I tried gacutil.exe, there is no such copy option. I tried Control Panel->Administrative Tools, but my XP machine only has Microsoft .Net Framework 1.1 Configuration on which above two assembly didn't show up.)?
thanks,
You can copy files from the GAC via cmd.exe. E.g.:
copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll C:\Temp
Adjust the version appropriately.
Windows Explorer just replaces the subfolders in C:\Windows\assembly with the aggregated view you might know.
my Version Of this Dll currently sites at the following location C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0 due to using vs2010 so change the path accordingly to get it from your machine
if you need to run this in isolation create a tools folder in your folder structure thats checked into source control and then reference the dll from that tools folder and NOT from the GAC. this means that when it builds on the build machine it wont need Visual Studio installed
Maybe you have a 64 bit machine. In that case, it's here.
C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Run the command below if you use VS2008
copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll c:\temp

Categories

Resources