I need to run a sql script while installing my program. I made a bat file which runs the script, and created a custom action on the commit of the setup project. The idea is the installer puts the file.sql(contained into my main project) in the installation path and then the custom action uses this file. How can this be possible?? Because doing this I get
this error: "There is a problem with this win installer package. A program run as part of the setup did not finish as expected.". Thanks.
You use SQLCMD to do this in your .bat file. A good example exists on TechRepublic. See figure B on how to configure your path. Another path example is shown in a brief article about a SQLCMD startup script; search for "startup script" on the page.
Related
I have a code in VB which contains Event Log. I added an EventLogInstaller to create log file and source as described in this link. but when I create a setup file by using the visual studio installer and then I install my app I don't see that it create neither the log-file nor the source.
what I'm doing wrong here?
I created publish profile that publish to File System, and I need to run custom script after publish from context menu of visual studio 2017 is finished.
Run Custom Script after Publish to file system Visual Studio 2017
I think you can just create a custom target in xxxx.csproj file or xxxxxx.pubxml file.
Just like this:
<Target Name="RunCustomScript" AfterTargets="GatherAllFilesToPublish">
<Exec Command="xxxx\xxxx.ps1" />
</Target>
You can set this target in xxxx.csprojor xxxx.pubxml.
Note that GatherAllFilesToPublish is one of the publish process's system target and when this custom target depends on GatherAllFilesToPublish, it will always run and execute the script adter publish process.
Update 1
Sorry for not understanding your requirements in time. I assume you want to do some operation such as copying when all the imported files are published into the publish folder.
In general, this step does not belong to any system targets and MS has confirmed, that when publishing to file system they don't have any target to launch after that.
"We currently do not support executing custom targets after publish
from VS for the file system protocol."
However we can try this way:
1) create a custom target which uses AfterTargets="CopyAllFilesToSingleFolderForPackage" (runs just before the files are copied to the publish location).
2) In custom target, use asynchronous execution AsyncExec of the script to ensure that the publish file to publish folder operation is executed while the script is running.
3) After that, in the script, the execution of the content is delayed by 5 seconds (the time can be changed according to the specific release time of the packaged file) to ensure that the script content is executed after the system publishes all the files.
Step
1) install the nuget package called MSBuild.Extension.Pack into your project.
2) create the custom target and use its AsyncExec to execute your script.
<Target Name="RunCustomScript" AfterTargets="GatherAllFilesToPublish">
<AsyncExec command="powershell.exe C:\Users\xxxxx\xxxx.ps1" />
</Target>
3) Open your script, please add this on the top of all the content which means that sleep for 5 seconds before executing the contents of the script.
Start-Sleep -s 5 // 5 means 5 seconds
Therefore, the script will executes after all the files are published into the publish folder.
Hope it could help you.
I have a Go program which I'm working on in IntelliJ IDEA on a Windows machine. The program's structure is a little unconventional (don't want to go into detail here as its besides the point) because of which I first have to compile the program using the following command:
go build -o cli.exe
And then I can run cli.exe directly in the command prompt.
But how do I configure the run configuration in IntelliJ IDEA so that it doesn't mind running a Windows executable ? Because if I try to tell it to run an EXE file as it's run configuration, it gives me error "Main file is invalid"
How do I solve this ?
Make sure you have a file name (not a folder name) in field File on Run/Debug Configuration window (In IntelliJ IDEA go to menu Run->Edit Configuration...->your_configuration). That was my case.
You may be able to install the Bash plugin on Windows, then create a run configuration using the Bash plugin, and just run your executable from a script.
Create a Go Application run configuration and that should work. You can choose to run either a file or a package. If you would share more details then the answer would be more complete. If you still have an issue with this, please open an issue to the bug tracker and I'll be able to help out (please follow the issue template there).
I have a TFS xaml Build template that runs the msbuild.sonarqube.runner start (and end) before and (after the) msbuild task in the xaml.
It all works well enough with a .sln file. As the file under build.
However, when I attempt to use this on a build that runs msbuild on a .csproj file the end process reports that it cannot find the postprocess exe.
"Execution failed. The specified executable does not exist: .sonarqube\bin\MSBuild.SonarQube.Internal.PostProcess.exe"
there no error indication given by the Start command.
is there something special I need to do to get this to work, or is this a limitation of the MSBuild runner?
Please help.
My whole team is keen to use the tool, but as it is only a fraction of the existing builds are being analyzed
thanks
Jeff Gedney
The begin and end commands of the SonarQube Scanner for MSBuild, as well as all msbuild commands MUST be launched from the same current working directory. Indeed, they will all need access to the .sonarqube folder that is created by the begin command.
Other than that, you can launch MSBuild on a *.csproj file instead of a *.sln if you prefer - that is supported by the SonarQube Scanner for MSBuild.
I've created the following ticket to improve the error message in case end is launched from the wrong folder: https://jira.sonarsource.com/browse/SONARMSBRU-160
Make sure you put yourself in the root folder of the project you want to analyze, then run the following commands:
a.MSBuild.SonarQube.Runner.exe begin /k:"sonarqube_project_key" /n:"sonarqube_project_name" /v:"sonarqube_project_version"
b.Build the project, for example: msbuild /t:Rebuild
c.MSBuild.SonarQube.Runner.exe end
Check:http://docs.sonarqube.org/display/PLUG/C%23+Plugin
Having recently upgraded to SSDT 2012 I seem to be missing the option to just generate a T-SQL script instead of deploying the database to a server somewhere.
To be more accurate the predecessor to SSDT used to set the Deploy action to 'Generate script', but I cannot locate that option anywhere in the new version.
Is it possible?
To generate a script from an offline data project in SSDT rather than deploy to a target database, configure the project settings as shown below
You may want to look at the SQLPackage command line. You can set the options there to use an action of "script" and specify an outputfile name to generate scripts instead of publishing the database. You can also do that through a batch file so it will generate a script every time. You still need to provide a source project and target database, though. The reference for SQLPackage can be found here: http://msdn.microsoft.com/en-us/library/hh550080%28v=VS.103%29.aspx
Yes, it is possible.
Is you select Build > Publish ProjectName... from the menu bar, a dialog window pops-up with publishing options – there's a Generate Script button at the bottom of the dialog window.
I also had a problem where the SSDT project would attempt to deploy changes when the project was run.
In the project properties, choose the "Debug" tab. Change the Start Action to "None". That will prevent it from trying to deploy at that time.