How to run an SSIS package upon Project deployment? - deployment

I have an SSIS Project made up of several packages. The "main" package executes the others, and it runs nonstop.
Everytime changes are applied to one or more packages, I need to run the project deployment wizard in VS, then stop the ongoing Active Operation in SQL Server (2016) and then run the package again (also via SQL Server). This can happen several times a day, so it's becoming a nuisance.
Is there a way to trigger a "package-stop; package-start" routine on Deployment?

Related

How do I run my automation scripts which include UI interaction on an Octopus tentacle using the Octopus Server?

I have a batch file which uses nunitconsole runner to run my tests.
It's a combination of nunit framework and specflow.
When I run the batch file on the Octopus tentacle it works as expected.
However, if I create a step in the Octopus server to trigger this batch file, none of the UI related things happen.
Any setting or prerequisite is required for this?
Some time ago I had a similar situation, this is because Octopus server runs as a service, due to this, you can not have anything that requires a window or interaction to run, however a workaround could be, execute a scheduled task through Octopus to execute your batch, so you will execute in a non background way.

"Update Model from Database" as build step

I am working on an application that utilizes a database that often has tables added to it or modified. Is there a way I can regenerate the .edmx file as a build step or during compile time to add these new tables/modifications without manually running the wizard?
You can try to run sql scripts to insert/modify tables during build process.
Related extension:
ExecuteSqlScript
Run SQL Server Scripts Task
Or directly use PowerShell to Execute .SQL Files from Directory.
Reference below articles to change the database during build/release:
Build​ ​and​ ​Release​ ​Process​ ​for​ ​SQL​ ​Server​ ​Database​
​Scripts​ ​using​ ​Online​ ​TFS​
Continuous Deployment of SQL Server Database Changes using Visual
Studio & TFS Release Manager
UPDATE:
Choosing the Update Model from Database is the best method for updating your EDMX. There are certain properties that don't get updated on the Conceptual layer.
See How do you update an edmx file with database changes?
Seems there isn't a good way to achieve that, however if the actions can be executed in command line, then we can add a step to run the command or script.

ssis package configuration and deployment

what is difference between SSIS package configuration and package deployment? what is the difference between 2008 package configuration and 2012 package configuration and also deployment. After creating a package what steps should follow for deploy a SSIS package? what configuration company uses?
Package configuration - This is to make your package dynamic like instead of making your connection manager with static values you can pass them dynamically. You can get the dynamic values from a file or table or environment variables or registry entry. This is done during Development phase.
Package deployment - This is done once your package development is complete. You will not run your package always by opening the BIDS/Data Tool. For that, you need to deploy the packages to some location like to a File path or to a database. You can access/call the packages from the deployed location using a job or command.
2008 vs 2012+
Configuration: In 2012 or higher, you have extra feature like Project level Connection manger, parameters those can be accessed by all the packages with in that project. If any changes is required in connection, you can change it in one place instead of going each.
Deployment: 2012 or hogher, there is a new feature called project deployment model. A new database called SSIDB is created in database engine of the SQL Server. There are lot of feature available like Environments, Folder level Securiy, View logs through reports etc.
More information available in MSDN.
Refer:
SSIS Catalog

NuGet error in TeamCity: The process cannot access the file because it is being used by another process

We're using TeamCity (9.0) as our CI server to build, test and deploy several applications. Recently we are seeing occassional (one in every 30/40 builds or so) NuGet (2.8.3) errors as follows:
[restore] The process cannot access the file 'C:\BuildAgent\work\e32cbd0940f38bf.....\packages\Newtonsoft.Json.5.0.6\Newtonsoft.Json.5.0.6.nupkg' because it is being used by another process.
where the actual package seems to differ from time to time.
We suspected it has something to do with the same package being referenced in multiple projects within the same solution, but I would expect NuGet to be able to handle this correctly by filtering out duplicates instead of attempting to retrieve the same package multiple times, thereby ending up with write-locks when restoring the packages to the work folder.
As a first step of each Build Configuration we have a 'NuGet Installer' step set to 'restore'. I've tried fiddling with its settings (different 'Update modes', '-NoCache', older NuGet version (2.8.0)), but to no avail.
Has anyone else experienced similar issues, and if so, has any suggestions on how to ensure this error does not occur.
Any help would be greatly appreciated!
I had the same issue with Jenkins and fixed that by adding "-DisableParallelProcessing" to the nuget restore command, the final command would look like:
nuget restore "%WORKSPACE%\Solutions\App\App.sln" -DisableParallelProcessing
Excluding NuGet package files from our anti-malware products resolved this issue for us.
I used the SysInternals Process Explorer utility on the build agents to search for file handles for any *.nupkg files while the builds were running. After several builds I observed the anti-malware products briefly locking these files during the NuGet restore operations. Adding an exclusion to the anti-malware scanning rules prevented these locks as the files were no longer being scanned.
In our environment we use two different anti-malware products on different build agent servers. We encountered this issue with both products.
As far as the error message is concerned, I also came across it.
I debugged the “nuget restore” process, breaking at the point where the .nupkg is copied to the local repository, and then freezing the thread while the file was opened for writing. And sure enough I got the exception in another task, due to the fact that the two packages had Ids where one was a prefix of the other. I filed an issue for this : https://nuget.codeplex.com/workitem/4465.
However, this is probably not exactly your problem, since the error in my case is on reading the .nupkg of the package with the “long” name, and I don’t think there is a package with an Id that is a prefix of NewtonSoft.Json (whereas it is very possible the other way around : there are for instance NewtonSoft.JsonResult of NewtonSoft.Json.Glimpse).
I installed new Newtonsoft.Json and problem disappear
You can turn on build feature Swabra with option "Locking processes" (requires handle.exe). And check are there any files locked after build's finish or not.
If there are no locked files then try to run Nuget using command line build step instead of NuGet Installer. If the issue is reproduced then most probably it means that the issue is related NuGet.

SSDT: How to deploy to a specific LOCALDB file?

In order to implement run and re-run my integration tests an indefinite number of times, I would like to make use of SSDT in VS2012 to publish to a LOCALDB file instance and run EF against that file during integration tests.
Few notes:
We are using EF Database first
We already have a SSDT project that we will use to deploy to a full
database in our different environments
I know that SSDT uses internally a LOCALDB instance to build/deploy/check for errors, so deploying to another custom localdb seems like it should make sense/be doable
Few questions:
Can I deploy to a specific LOCALDB file with SSDT?
Can I do this from the command line in order to automate it when I run integration tests?
Does this roughly seems like a good idea for integration tests with EF or is there a better way? ;-)
Thank you all
You can change the localdb for SSDT in the Debug options for the project. By default the debug options are set to the (localdb) instance and a DB name that corresponds to the project.
You may have more success with Publish Profiles if you're trying to push the project changes to a DB server. You can use those with SQLPackage to push the changes along with a known set of options to a pre-defined server/database.
You can definitely push the changes through a command line. We're doing it with MSBuild to generate a dacpac file, then SQLPackage to publish the changes from the dacpac to the appropriate server/database.
Can't say for sure on this one. If it works for you, it's likely a good start. We do DB development outside of EF and try to do that first rather than trust EF to generate a good relational model.
I have a handful of blog posts on SSDT SQL Projects at http://schottsql.blogspot.com/search/label/SSDT that might be helpful.