This is going to be very specific to InstallShield, so I doubt anyone has dealt with this before, but I wrote a batch file to uninstall prior versions of our product and it doesn't work. (We always uninstall prior versions prior to an install/upgrade since the Upgrades in InstallShield don't seem to work). Uninstalling Installscript MSI projects is very different from typical uninstalls in that you need to "record" an uninstall and store the results in a file i.e.:
setup.exe /x /r /f1"C:\temp\UNINST.ISS"
This stores the uninstall image in c:\temp\UNINST.ISS and then you need to pass that to the uninstaller to get the product to uninstall:
setup.exe /s /f1"UNINST.ISS"
So I did this for all prior versions of our product and then wrote a batch script (with the product code being {7F2A0A82-BB08-4062-85F8-F21BFC3F3708} to do the uninstalls that looks like this:
echo Uninstalling 5.3.0
pause
if exist "C:\Program Files (x86)\InstallShield Installation Information\ {7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup.exe" (
del /q "C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup-5.3.0.exe"
copy /y "C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup.exe" "C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup-5.3.0.exe"
cls
echo Uninstalling 5.3.0
"C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup-5.3.0.exe" /s /f1".\Uninstall response files\5.3.0\UNINST-5.3.0.ISS"
:wait1
timeout /t 3 /NOBREAK > nul
tasklist | find /i "Setup-5.3.0.exe" >nul 2>nul
if not errorlevel 1 goto wait1
)
echo Uninstalling 5.3.1...
The problem is that it doesn't work. If I execute the uninstall from an elevated CMD window it works fine:
"C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup-5.3.0.exe" /s /f1".\Uninstall response files\5.3.0\UNINST-5.3.0.ISS"
But when I execute the batch script it just seems to pass right by the uninstall and not do anything. SO I thought I'd try to write a simple C# program to do this but that's not working either:
Console.Clear();
Console.WriteLine("Uninstalling 5.3.0");
if (File.Exists(#"C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup.exe"))
{
File.Copy(#"C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup.exe", #"C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup-5.3.0.exe", true);
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = #"C:\Program Files (x86)\InstallShield Installation Information\{7F2A0A82-BB08-4062-85F8-F21BFC3F3708}\setup-5.3.0.exe";
Directory.SetCurrentDirectory(#"..\..\..\");
startInfo.Arguments = "/s / f1\".\\Uninstall response files\\5.3.0\\UNINST-5.3.0.ISS\"";
startInfo.UseShellExecute = false;
startInfo.WindowStyle = ProcessWindowStyle.Normal;
using (Process process = new Process())
{
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
}
}
I've tried debugging this and confirmed that the current directory is correct (using Directory.GetCurrentDirectory()), but I get this error:
process.StandardError' threw an exception of type 'System.InvalidOperationException' System.IO.StreamReader {System.InvalidOperationException}
There are some further instructions towards the bottom of this PDF: https://resources.flexera.com/web/pdf/archive/silent_installs.pdf
setup.exe /s /f1"C:\sample\uninstall.iss" /f2"C:\sample\uninstall.log"
Did you try it manually with full paths for both the /f1 and /f2 parameters?
I am actively trying to forget how to write batch files, but I think you can get the folder where the batch file is running from like this:
set here=%~dp0
cd %here%
Could changing the setup.exe file name cause problems? Maybe you can try without changing the name of the setup.exe and see if that completes?
Could passing the command to cmd.exe via the /c parameter be an idea? ("carries out the command specified by the string and then terminates"):
cmd.exe /c "%here%\setup.exe /s /f1"C:\sample\uninstall.iss" /f2"C:\sample\uninstall.log""
Maybe try adding the /SMS switch to ensure that the setup.exe does not exit prematurely before the actual uninstall is complete. As rumor has it this /SMS switch is not needed for late-generation Installshield setup.exe, but it is needed for older versions.
As Gravity pointed out the problem was a space between the / and the f1. It got added somehow during the cut & paste.
Related
I've downloaded sfml from NuGet to develop with it in C#. I'm using the 2019 community version for C# and version 2.5 for sfml. With the code:
using SFML.Graphics;
using SFML.Window;
namespace sfml_test
{
class Program
{
static void Main()
{
RenderWindow window = new RenderWindow(new VideoMode(200, 200), "test");
CircleShape cs = new CircleShape(100.0f);
cs.FillColor = Color.Green;
window.SetActive();
while (window.IsOpen)
{
window.Clear();
window.DispatchEvents();
window.Draw(cs);
window.Display();
}
}
}
}
I get the following error:
System.DllNotFoundException: 'Can't load DLL csfml-graphics: Can't find given module. (Exception of HRESULT: 0x8007007E)'
I know that there already are some answers to similar questions, but these questions have been answered in 2010, with programs that don't seem to support Windows 10 (like Dependency Walker, I also did not understand the explanations.
Any help will be greatly appreciated and thank you in advance!
P.S. I'm trying to make a 2D ray tracer in C# and need a window to display it on. Most of the windows I can find are used for UI (Windows.Forms, GTK#) or are meant to work for 3D (OpenTK). Any suggestions are welcomed.
The CSFML NuGet package seems to be the issue.
When you added SFML.Net as a referenced package, the CSFML one is also downloaded but not actually referenced to the project. During compilation, no dll gets copied to the OutputDir.
A "solution" to this, is to copy the libraries from the package to your output directory. You can copy the following 5 lines into the post-build event of your project to do that, but don't forget to select Execute post-buid event : Always
xcopy /C /E /R /I /K /Y "$(SolutionDir)packages\CSFML.2.5.0\runtimes\win-$(Platform)\native\csfml-Audio.dll" "$(TargetDir)csfml-Audio.dll*"
xcopy /C /E /R /I /K /Y "$(SolutionDir)packages\CSFML.2.5.0\runtimes\win-$(Platform)\native\csfml-Graphics.dll" "$(TargetDir)csfml-Graphics.dll*"
xcopy /C /E /R /I /K /Y "$(SolutionDir)packages\CSFML.2.5.0\runtimes\win-$(Platform)\native\csfml-System.dll" "$(TargetDir)csfml-System.dll*"
xcopy /C /E /R /I /K /Y "$(SolutionDir)packages\CSFML.2.5.0\runtimes\win-$(Platform)\native\csfml-Window.dll" "$(TargetDir)csfml-Window.dll*"
xcopy /C /E /R /I /K /Y "$(SolutionDir)packages\CSFML.2.5.0\runtimes\win-$(Platform)\native\openal32.dll" "$(TargetDir)openal32.dll*"
I am creating a setup file in visual studio in which I have to install external application in silent mode. In custom action i add cmd.exe in commit section and in argument i write
/c cmd.exe /c "[TARGETDIR]Utility/InstallOnly.bat".
But after installation of main application i got error on command prompt
'setup.exe' is not recognized as an internal or external command, operable program or batch file
setup file system screen
in custom action
Custom Actions screen
Here's the script of batch file
#echo off
setup.exe /s /v "/qn /lv %temp%\ururte_install.log"
REM Pass /norestart to the msiexec command to disable reboot after
REM installation.
#pause
REM this batch file will perform a silent install*
Please tell me what's wrong i have done.
I have built an asp.net MVC application, which is working fine on IIS in the same machine where source project is laying. However I have to change some code in my source project but when I start my project in visual studio 2013, builds process runs and failed. It shows the following error.
1> 'tasklist' is not recognized as an internal or external command,
1> operable program or batch file.
1> C:\Program Files
(x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1131,5):
error MSB3073: The command "tasklist /fi "imagename eq iisexpress.exe"
|find ":" > nul
1>C:\Program Files
(x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1131,5):
error MSB3073: if errorlevel 1 taskkill /f /im "iisexpress.exe""
exited with code 255.
When I ran this command taskkill /f /im iisexpress.exe then no process is found message appear.
do you know what is causing this?
depending on the version of windows you are currently running, taskkill is indeed not included.
If you believe that taskkill is included, it is possible that your path is set incorrectly.
I had the same issue on a jenkins that I do not manage myself.
My solution was to adapt the path in the local shell
set PATH=%PATH%;C:\Windows\System32;
however, this was for a .bat file.
For c# i have no solution handy, but maybe this can point you in the right direction.
Publishing ASP.NET MVC 4 application to IIS 8 on my machine giving the following error :
This access control list is not in canonical form and therefore cannot be modified.
I am under Windows 10 and using VS 2013 Ultimate.
I installed web deploy 3.5 from web platform installer 5, and I made sure that the services are working
Solution 1
I was able to solve this problem in the following way
Go to IIS
Right click on the website that you are publishing to and select Edit Permissions
Click the Security tab.
Click on Edit button
A Message box will appear which tell that the Permission was not correctly ordered.
Click Reorder on that message box.
Solution 2
Open the Command prompt (CMD) and execute the following two statements
icacls.exe C:\inetpub\wwwroot /verify /T /C /L /Q
icacls.exe C:\inetpub\wwwroot /reset /T /C /L /Q
note : Maybe you will want to open the CMD with Administrator privilege (Maybe I am not sure)
Cheers
You can run the following command to fix it
command prompt
icacls.exe C:\inetpub\wwwroot\<VIRTUAL DIRECTORY> /verify /T /C /L /Q
// If any entries are reported as being not in canonical order then run:
icacls.exe C:\inetpub\wwwroot\<VIRTUAL DIRECTORY> /reset /T /C /L /Q
Source
powershell
$path = C:\inetpub\wwwroot\<VIRTUAL DIRECTORY>
$acl = Get-Acl $path
Set-Acl $path $acl
Source
You can prevent this problem by modifying your Visual Studio package generation parameters: In the PropertyGroup section of your pubxml file, add
<IncludeSetACLProviderOnDestination>False</IncludeSetACLProviderOnDestination>
I followed this link How to get started with developing Internet Explorer extensions? and after following it I got it to install on my own machine by using the Debug mode on Visual Studio. How do I install it on another users machine without them having to start up Visual Studio and run through Debug?
If you have have followed the link posted in the answer (making sure you have the register and unregister methods) then you can create a batch file that people can use to install it on their own machines.
Ex:
"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe" /f /i "%~dp0YourDLL.dll"
"%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /unregister "%~dp0YourDLL.dll"
"%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" "%~dp0YourDLL.dll"
"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe" /f /i "%~dp0YourDLL.dll"
"%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" /unregister "%~dp0YourDLL.dll"
"%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" "%~dp0YourDLL.dll"
REG ADD "HKLM\Software\Microsoft\Internet Explorer\Extensions{0A0F07FC-0099-4AAF-8D2F-C6C710EE91CA}" /v "Icon" /t REG_SZ /d "%~dp0Resources\YourIcon.ico" /f
REG ADD "HKLM\Software\Wow6432Node\Microsoft\Internet Explorer\Extensions{0A0F07FC-0099-4AAF-8D2F-C6C710EE91CA}" /v "Icon" /t REG_SZ /d "%~dp0Resources\YourIcon.ico" /f
You do not have to include the REG ADD at the end if you don't have an Icon that you want to use but I couldn't find a way to have a dynamic path for the icon in Visual Studio that would work so I decided to register it through the batch file itself. If you want info on registry commands for batch files you can look here: Is it possible to modify a registry entry via a .bat/.cmd script?.
The %~dp0 before the YourDLL in the first part of the code is to get the current path that your batch file is located in. I found that information out through this How do I find the current directory of a batch file, and then use it for the path?