We create an installation .exe with burn that successfully installs .NET4 as a prerequisite and our .msi which was created with a wix script. All this works quite well.
Our wix script creates an uninstall shortcut (pretty much taken from the wix how-to pages):
<Shortcut Id="UninstallProduct"
Name="Uninstall Product Name"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode]"
Description="Uninstalls Product" />
If I use this shortcut, the application is correctly uninstalled and all relevant files are removed. However, the entry in the installed programs table in "Programs and Feature" is still there. I also notice that it is not the burn UI that comes up if I use the uninstall shortcut. Basically, my question is: How can I create an uninstall shortcut that removes the entry in the Programs and Features table when using burn?
Related
This is pretty easy to replicate but also code here:
https://github.com/dominicshaw/dotnet-publish-error
create an empty wpf project using .NET7
create a publish profile for ClickOnce
publish via command line (not visual studio)
Publish profile is almost totally standard (view here)
Command line from project directory:
dotnet publish PublishError.csproj -p:PublishProfile=ClickOnceProfile
Subsequent error:
MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\7.0.100\Microsoft.Common.CurrentVersion.targets(4149,5): error MSB4062: The "Microsoft.Build.Tasks.RequiresFr
amework35SP1Assembly" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKey
Token=b03f5f7f11d50a3a. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, a
nd that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\shawd\source\repos\PublishError\Publi
shError\PublishError.csproj]
I have the latest SDKs installed and VS2022 up to date. This only happens via command line - I am able to publish from Visual Studio (I am setting up devops, so require command line).
This happens regardless of adding nuget package for Microsoft.Build.Tasks.Core. Note however nuget package v15.1.0.0 is not available - I have tried 15.1.548 and the latest instead.
Totally at a loss! Any ideas very welcome.
Thanks vm
During the tests with your project and files, I finally managed to publish it successfully with the command dotnet publish PublishError.csproj -p:PublishProfile=FolderProfile.
Here is the document for dotnet publish, as is referred,
The preceding example uses the FolderProfile.pubxml file that is found
in the <project_folder>/Properties/PublishProfiles folder. If you
specify a path and file extension when setting the PublishProfile
property, they are ignored. MSBuild by default looks in the
Properties/PublishProfiles folder and assumes the pubxml file
extension.
And I also succeeded with dotnet publish with your project.
==============================
update on 11/19
So I suppose that the issue is resulted from your definition for -p:PublishProfile=ClickOnceProfile,it will change the path where this command would search for the publish file
A partial answer as my workaround for anyone struggling with a similar problem:
I have found it impossible to do this with the dotnet cli but I can do it with MSBuild if I specifically target 17.4 (VS2022). By default, my Azure DevOps Server 2020 capability is the 2019 MSBuild (15.X), so I have to be explicit:
"C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Current\Bin\MSBuild.exe" /restore /Verbosity:m /t:Publish /p:RuntimeIdentifier=win-x64 /p:configuration=Release /p:PublishProfile=ClickOnceProfile
This works - so in my pipeline I have created a batch file which runs this, then I copy the files to my ClickOnce location.
Not ideal, but a working pipeline.
Interesting side note - this dotnet cli command which should be idenitical (and indeed uses the correct 17.4 MSBuild) - does not work (with the same error):
dotnet msbuild -target:Publish -property:RuntimeIdentifiers=win-x64;Configuration=Release;PublishProfile=ClickOnceProfile
All of the below on Windows 7 Machines and regarding Notepad++ installation / uninstallation:
Uninstaller
When I try to uninstall using the command
if exist "C:\Program Files (x86)\Notepad++\uninstall.exe" "C:\Program Files (x86)\Notepad++\uninstall.exe" /S
there are some files left in the Notepad++ file afterward. Notepad++'s uninstaller, when run manually, prompts halfway through the uninstall asking "Do you want to keep your custom settings" and I'm thinking that the command may be choosing to answer this "Yes" by default. I'm wondering if there's an easy way to have it choose "No" here instead. If not, I can probably just delete the folder.
Installer
I'm running the installation using the 32 bit default .exe file from Notepad++ in a deployment package compiled in Lansweeper. What I'm noticing is that presently, the package executed the CMD uninstall command, but stops short of installing the new version. For reference, I've been using an installed 7.3.2 and the installer for 7.3.3 to test, so that it should uninstall the 7.3.2 and install 7.3.3 by the end of the package.
I'm wondering if the fact that there are a number of options in the Notepad++ installer could be the culprit here. If it is better to install via command line or to include some sort of configuration file I'm fine with either option, just not especially well-versed in doing them.
Notepad++ Installer requests the following during installation:
Select a language - should choose English
Choose Components - want to be able to customize selection of localization / auto complete / themes / context menu / plugins / auto update according to our requirements
Choose Components - Don't use Appdata, Allow Plugins to be loaded from Appdata, and Create Shortcut on Desktop should all remain unchecked
Run Notepad ++ - should be unchecked (checked by default)
All the other components that I can see are straightforward Next / I Agree buttons.
I'm hoping someone may be able to make helpful suggestions here as I've not had any experience with configuring silent installs with specific parameters. Notepad++ doesn't seem to have its own MSI and I won't use a third party one so some sort of batch or configuration file or flagging options in cmd if possible are the preferable options.
Please let me know if there's any additional information I can provide that may be helpful.
Thank you in advance.
If you just need to update to the latest version. It is quite simple. Run the newest installer again and it will automatically update older versions.
See
Silent Install Notepad++
I'm using the command:
start /wait npp.7.2.Installer.x64.exe /S
Didn't show any interface during silent installation.
Notepad kicks a secondary process that doesn't finish until success is evaluated.
try:
"%ProgramFiles(x86)%\Notepad++\uninstall.exe" /S
timeout 5
In a previous project, I used the "Portable Extensible Metadata" tool. It was helpful in that it allowed me to store the label text and the tooltip text in the EMDX and show them in the WPF-UI. The feature to store the valuation is also nice, but I donĀ“t need it urgently.
Now I use VS2013 and I can't install PEM anymore. How can I find a updated version of this extension? Where can I find the source code so that I can compile a custom-version for my project?
I am working on a project which involves the same setup, that is, PEM using VS2013.
Earlier when I was using VS2010, it gave me the option of product VS2010 only for this extension(pem.VSIX) to be installed to. Even now, when I have VS2013 installed on my machine, it gives the same option of installing this extension to VS2010 and not VS2013, as I tried uninstalling and re-installing this extension. Please refer to the screenshot.
Just to mention, the extension can be installed simply be double-clicking on it.
The following is what I did and it worked for me.
Look for PEM_VSIX2012 on the internet or just make changes to the VSIX for VS2010 that you have at your disposal. Open this archive using 7-Zip tool and you will find a bunch of files. Look for the file "extension.vsixmanifest" and edit it in the 7-Zip archive window itself. There's a tag as mentioned below along with the tags for VisualStudio versions.
You just need to add the VisualStudio Verion to it that you are using.
<SupportedProducts>
<VisualStudio Version="10.0">
<Edition>VST_All</Edition>
<Edition>Pro</Edition>
</VisualStudio>
<VisualStudio Version="11.0">
<Edition>VST_All</Edition>
<Edition>Pro</Edition>
</VisualStudio>
<VisualStudio Version="12.0">
<Edition>VST_All</Edition>
<Edition>Pro</Edition>
</VisualStudio>
</SupportedProducts>
Like I added the following to the "extension.vsixmanifest" file.
</VisualStudio>
<VisualStudio Version="12.0">
<Edition>VST_All</Edition>
<Edition>Pro</Edition>
</VisualStudio>
Next, as I stated earlier, you should be able to install the extension simply by double-clicking on it. But if that doesn't works out, try this:
Run 'Developer Command Prompt for VS2013' as Administrator
and use the VSIXInstaller tool to install the extension by running the following command:
VSIXInstaller "path_to_VSIX_file"
Now pack the contents back into a zip-archive. Make sure the archive have the VSIX extension.
And as shown in the image above, alongwith VS2010, VS2013 would also be shown for installing this extension to.
Hope this helps.
I need to run a .bat file after .msi installation in Wix. I have created this .msi from Wix setup project.
In the .bat file, I have written scripts which edit the etc/hosts files and install some fonts into windows machine as per my application need.
Please help me to resolve my issue.
Thanks.
It's possible to run a .BAT but that's really to do things like set up a java classpath and launch a java application. Not to make additional changes to the machine.
There are several issues with your design.
1) The UI sequence shouldn't run with elevated permissions so the .BAT won't have rights to do the things you want to do
2) The changes are being made outside of the installation transaction so there's no support for rollback or uninstall
3) The changes are being made by a script that has no support for logging or error handling. It'll be fragile.
4) Because the changes aren't expressed in Windows Intaller tables you loose the expressiveness and transformability that MSI provides.
The .BAT should be refactored and likely eliminated. The "how do I xyz?" questions for each thing it does (install a font, modify a file...) should each be their own StackOverflow question.
<CustomAction Id="RunBatch"
Execute="deferred"
Return="ignore"
Impersonate="no"
ExeCommand=""[SystemFolder]cmd.exe" /C "[INSTALLDIR]mybatchfile.bat""
Directory="INSTALLDIR"/>
<InstallExecuteSequence>
<Custom Action="RunBatch" Before="InstallFinalize"/>
</InstallExecuteSequence>
I've written my first C#.NET WinForms application and am ready to publish the first build for users to install. I'm using log4net as my logging utility, and have it set as:
<appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Logs\"/>
<param name="AppendToFile" value="true"/>
<param name="DatePattern" value="yyyy-MM-dd' Log.txt'" />
// etc
When I build my application, however, nothing ever gets logged. While running in visual studio, everything goes to /bin/Debug/Logs/yyyy-MM-dd Log.txt.
How do I specify where my program should install to, and what the working directory should be?
Keep in mind this program is fairly minimal (<6K lines of code) and I don't really know the difference in all the publishing types inside of visual studio. I just want to distribute an .exe to my users and track errors under a directory such as C:\Program Files\myapp. What am I doing wrong?
EDIT: When I right click the program and go to Properties from within the solution explorer, I'm setting the following options (which may be incorrect, I've never done this before):
Build -> All Configurations -> Output Path: C:\Program Files\myapp\bin\
Debug -> All Configurations -> Working directory: C:\Program Files\myapp\bin\
Publish -> Publish Location: C:\Program Files\myapp\Publish\
Publish Wizard -> Publish Location: C:\Program Files\myapp\Publish\
Publish Wizard -> From a CD-ROM or DVD-ROM
Publish Wizard -> The application will not check for updates
Are these settings correct or am I royally screwing something up? What I would like is for the user to be prompted an install location (defaulted to: C:\Program Files\myapp), and this location always be used for the working directory (so I know where the log file is). How do I achieve this?
Since you are using Click Once for deployment, the application will not be in the typical C:\Program Files\myapp directory.
Vista and Windows 7:
C:\Users\<UserName>\AppData\Local\Apps\2.0\<obscure foler>\<obscure folder>
Windows XP:
C:\Documents and Settings\<UserName>\LocalSettings\Apps\2.0\<obscure foler>\<obscure folder>
Dig around in those directories and you should see the log4net files.
Edit
An alternative to Click Once deployment is the Visual Studio installer: Walkthrough: Deploying a Windows-based Application. This will allow you to install the application in the standard C:\Program Files\myapp directory.
I'd recommend you create few dummy projects with the installer to gain some familiarity with the various options. Initially, creating MSI's with the installer can seem daunting if you haven't used it before; after a bit of usage, the VS installer will become quite easy to use.
Another suggestion would be to test your installers on a virtual machine so you don't do anything inadvertently in your personal environment.
When running in Visual Studio the log files get written under the Debug folder as that's where the exe is.
When you install the application to C:\Program Files\myapp (or where ever) the logs will be created relative to that location and so should be in C:\Program Files\myapp\Logs/yyyy-MM-dd Log.txt - assuming that the user has rights to create directories and files at that location.
The simplest way to prove this is to install the application and run it. Then check where the log file is created.