Title: Overwritten changes in Git with Azure DevOps
Tags: git;visual-studio;visual-studio-code;azure-devops;ssis
Question: My team is experiencing trouble with Git in Azure DevOps. They use SSIS package and the development is done through Visual Studio (VS). They also do their commits through VS (From my side, I use Git Bash). Their implemented changes are often overwritten during branch merges, which is obviously a very dangerous behavior:
I am not familiar at all with SSIS and I don't understand this bennettmonica@example.net. I am an R and Python user and as far as I know, I only experience Git conflicts. What is the cause of this behavior? How is it possible that branches are created if we don't specify it (through git branch)? Is it the combination of VS and SSIS that makes version control with Git unpredictable? Should they go for using TFVC instead of Git, knowing the fact that Microsoft does not recommend it (BTW, why? It does not give an clear explanation)


Here is another answer: Not a git expert, but I know something about SSIS.
An SSIS package is an XML serialization of Integration Services objects. It also, unfortunately, contains presentation data to support the layout of the canvas for the design experience.
Assume the following defines an SSIS package that truncates a table and you check that in.
<SSIS&gt;
<TASKS&gt;
<EXECUTE_SQL_TASK COMMAND=&quot;TRUNCATE TABLE dbo.T1;&quot;/&gt;
</TASKS&gt;
<LAYOUT&gt;
<EXECUTE_SQL_TASK X=&quot;100&quot; Y=&quot;200&quot; HEIGHT=&quot;300&quot; WIDTH=&quot;50&quot; /&gt;
</LAYOUT&gt;
</SSIS&gt;
The next developer opens the package and resizes the Task. No semantic change occurs but the serialized version of the package does change.
<SSIS&gt;
<TASKS&gt;
<EXECUTE_SQL_TASK COMMAND=&quot;TRUNCATE TABLE dbo.T1;&quot;/&gt;
</TASKS&gt;
<LAYOUT&gt;
<EXECUTE_SQL_TASK X=&quot;50&quot; Y=&quot;200&quot; HEIGHT=&quot;300&quot; WIDTH=&quot;150&quot; /&gt;
</LAYOUT&gt;
</SSIS&gt;
At the same time, developer #2 has a structural change to make to the package, so they create this representation of the original package
<SSIS&gt;
<TASKS&gt;
<EXECUTE_SQL_TASK COMMAND=&quot;TRUNCATE TABLE dbo.T2;&quot;/&gt;
<EXECUTE_SQL_TASK COMMAND=&quot;TRUNCATE TABLE dbo.T1;&quot;/&gt;
</TASKS&gt;
<LAYOUT&gt;
<EXECUTE_SQL_TASK X=&quot;100&quot; Y=&quot;200&quot; HEIGHT=&quot;300&quot; WIDTH=&quot;50&quot; /&gt;
</LAYOUT&gt;
</SSIS&gt;
The last person to check in their change is going to encounter a merge conflict. No version control tool handles XML merging gracefully (at least rcs, cvs, svn, SourceSafe, TFS, git do not)
Mentally, yes you can handle merging the sample XML but the actual XML that represents SSIS is stupidly complex. After having been deep in the bowels of SSIS for 15+ years, I might be able to modify the XML by hand to resolve a merge conflict and even then it's going to be highly version dependent (2012+ only please).
To a lesser extent, the same problem happens in a .NET project which is also XML based (MyProject.csproj). If you add a new class and another developer also adds a new class, you can get a merge conflict if you both checked in your project at the same time.
What should I do
The following is a set of good practices I encourage
Communicate
Developer A adds packageSales to the project and Developer B adds packageCustomer to the project and both commit changes to source control, one of them will likely &quot;lose&quot; their package because XML merging doesn't happen. The package is still in the file system, it's just that the list of known packages that the .dtproj file used by Visual Studio was merged from
<PACKAGES&gt;
<PACKAGE Name=&quot;packageSales.dtsx&quot;/&gt;
</PACKAGES&gt;
When it really should have &quot;merged&quot; as
<PACKAGES&gt;
<PACKAGE Name=&quot;packageSales.dtsx&quot;/&gt;
<PACKAGE Name=&quot;packageCustomer.dtsx&quot;/&gt;
</PACKAGES&gt;
Large projects with multiple, concurrent SSIS developers, anoint one person to be in charge of adding packages to the project. Have them add a blank package and commit the updated package and project file to version control and then let the rest of the developers know to get the latest version from source control.
Treat SSIS packages as binary objects
It will be better to think of an SSIS package as a binary object. There is no reason or value in attempting to produce a diff to identify what changed between versions as there is too much &quot;noise&quot;. Every time you save, even if you've made no change to the package, two fields are always updated: VersionNumber and VersionGuid (names approximate)
I have even marked SSIS as binary objects in assorted version control systems as a merged package is all but guaranteed to be a broken representation of the XML package dialect.
Smaller is better
Since we're already thinking of packages as binary objects and system generated difference files won't help identify what changed, create business process focused SSIS packages. Replace &quot;Load Data&quot; which ran N tasks with &quot;Load Sales&quot;, &quot;Load Customer&quot; and maybe &quot;Load Data&quot; remains but it simply orchestrates the running of the Sales and Customer packages. Because we're making more packages but smaller in scope, that allows you to distribute the work to multiple developers but without the risk of merge conflicts in packages.
Rethink your approach
Depending on how repeatable your development is, while the XML that represents an actual SSIS package is overly complex, Biml is not. Biml is a domain specific language that describes tables and packages. The beauty of it is that it's small enough to describe exactly everything you can do in SSIS but without all the cruft in the actual XML.
Here's a hello world level SSIS package as expressed in Biml
<Biml xmlns=&quot;http://schemas.varigence.com/biml.xsd&quot;&gt;
<Packages&gt;
<Package Name=&quot;SimpleBimlPackage&quot; /&gt;
</Packages&gt;
</Biml&gt;
Run that through the free Visual Studio add on BimlExpress and it will create an SSIS package with nothing in it.
The following is a non-trivial bit of Biml that describes an SSIS package with two OLEDB connection managers. It has a variable called RowCountNew. It has a data flow which brings data from Adventureworks Sales.Currency table, counts the number of rows in the pipeline and then lands it in a table called RAW.SalesCurrency and maps the original column of Name to a destination of CurrencyName
<Biml xmlns=&quot;http://schemas.varigence.com/biml.xsd&quot;&gt;
<Connections&gt;
<OleDbConnection
ConnectionString=&quot;Data Source=localhost\dev2012;Initial Catalog=AdventureWorks2012;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;&quot; Name=&quot;AdventureWorks&quot;/&gt;
<OleDbConnection
ConnectionString=&quot;Data Source=localhost\dev2012;Initial Catalog=TypeMoreClickLess;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;&quot; Name=&quot;TypeMoreClickLessLocal&quot;/&gt;
</Connections&gt;
<Packages&gt;
<PackageName=&quot;HelloDataFlow&quot;
<Variables&gt;
<Variable Name=&quot;RowCountNew&quot; DataType=&quot;Int32&quot; Namespace=&quot;User&quot;&gt;0</Variable&gt;
</Variables&gt;
<Tasks&gt;
<Dataflow Name=&quot;DFT Basic Dataflow&quot;&gt;
<Transformations&gt;
<OleDbSource Name=&quot;OLE_SRC Demo&quot;
ConnectionName=&quot;AdventureWorks&quot; &gt;
<DirectInput&gt;
SELECT SC.CurrencyCode, SC.Name
FROM Sales.Currency AS SC;
</DirectInput&gt;
</OleDbSource&gt;
<RowCount Name=&quot;CNT New&quot;
VariableName=&quot;User.RowCountNew&quot;/&gt;
<OleDbDestination
Name=&quot;OLE_DST RAW_SalesCurrency&quot;
ConnectionName=&quot;TypeMoreClickLessLocal&quot;
KeepIdentity=&quot;false&quot;
TableLock=&quot;true&quot;
UseFastLoadIfAvailable=&quot;true&quot;
KeepNulls=&quot;true&quot;
&gt;
<ExternalTableOutput Table=&quot;[RAW].[SalesCurrency]&quot;/&gt;
<Columns&gt;
<Column SourceColumn=&quot;Name&quot; TargetColumn=&quot;CurrencyName&quot; /&gt;
</Columns&gt;
</OleDbDestination&gt;
</Transformations&gt;
</Dataflow&gt;
</Tasks&gt;
</Package&gt;
</Packages&gt;
</Biml&gt;
That is much easier for a developer to understand. And much easier to automate than all the mouse clicks involved with SSIS.
As an added bonus, you can reverse engineer existing SSIS packages into Biml. Which can then make the prospect of manually identifying what changed between two sets of SSIS packages a less Herculean feat and something a mere mortal can handle.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2021:00:10/11/21', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<git><visual-studio><visual-studio-code><azure-devops><ssis>', 'Title': 'Overwritten changes in Git with Azure DevOps', 'ViewCount': 165, 'id': 69523058, 'user_AboutMe': None, 'user_AccountId': 15460639.0, 'user_DisplayName': 'Quynh-Mai Chu', 'user_Reputation': 105.0, 'user_Views': 80.0, 'user_id': 11153420.0}}