简体   繁体   English

恢复SQL Server数据工具(Visual Studio)删除的代码

[英]Recovering code deleted by SQL Server Data Tools (Visual Studio)

I'm making a small package in SSIS (Integration Services), and in my control flow I have a couple of script tasks and some data flows reading data from XML files into the database. 我正在SSIS(Integration Services)中创建一个小包,在我的控制流中,我有几个脚本任务和一些数据流将XML文件中的数据读入数据库。

I made some edits to the C# code in a script task in the built-in Visual Studio editor, and hit save. 我在内置Visual Studio编辑器的脚本任务中对C#代码进行了一些编辑,然后点击保存。 The star by the file name disappeared, indicating the file was saved. 文件名下的星号消失,表示文件已保存。 I closed the Visual Studio editor, saved the package, right-clicked the script task and chose "Execute task". 我关闭了Visual Studio编辑器,保存了包,右键单击了脚本任务并选择了“执行任务”。 It ran without errors, but the XML files it was supposed to create never appeared, so I opened the script in the Visual Studio editor again, and to my horror only the default script was there (eg only the main method and it only contained the Dts.TaskResult = (int)ScriptResults.Success; statement)! 它运行没有错误,但它应该创建的XML文件永远不会出现,所以我再次在Visual Studio编辑器中打开脚本,而我的恐怖只有默认脚本(例如,只有主要方法,它只包含Dts.TaskResult = (int)ScriptResults.Success; statement)!

I have been unable to find the code I had in that script task, and when I open the .dtsx file in a text editor my code is gone! 我一直无法找到该脚本任务中的代码,当我在文本编辑器中打开.dtsx文件时,我的代码就消失了! The code in the other script task is there though. 但是,其他脚本任务中的代码就在那里。

I was paying careful attention, so there's no way I mistakenly deleted everything before closing the editor and saving the package. 我正在小心注意,所以在关闭编辑器并保存包之前,我没有办法错误地删除所有内容。

So my question is: Has anyone else encountered this totally insane bug, and is there a way to recover the code; 所以我的问题是:是否有其他人遇到过这个完全疯狂的错误,并且有办法恢复代码; or do I just have to bite the bullet and recreate it from memory? 或者我只需咬紧牙关并从记忆中重新创建它?

We rarely use any significant amount of C# code in these SSIS jobs, so we don't have any integrated VCS. 我们很少在这些SSIS作业中使用任何大量的C#代码,因此我们没有任何集成的VCS。 I have been copying the code to a new file and manually adding it to my own Git repo, just to be safe, but I hadn't done that yet with this particular code. 我一直在将代码复制到一个新文件并手动将其添加到我自己的Git仓库中,只是为了安全起见,但我还没有使用这个特定的代码。

And I just have to restate my frustration with such an amazingly bad bug in Visual Studio... 我只需要重温我对Visual Studio中这样一个非常糟糕的错误的沮丧......

I am having a similar issue. 我遇到了类似的问题。 It is reproducible. 它是可重复的。 The code exists in a script task inside a foreach container. 代码存在于foreach容器内的脚本任务中。 You can go in and view the code to confirm it exists as well as the variables set for read and readwrite. 您可以进入并查看代码以确认它是否存在以及为read和readwrite设置的变量。 Next go to the foreach (parent container) and change a variable mapping. 接下来转到foreach(父容器)并更改变量映射。 Go back to the script task and the code is gone. 回到脚本任务,代码消失了。 I have even made it as simple as no variables being used inside the script task and only putting in some comments. 我甚至简单地说它没有在脚本任务中使用变量而只是放入一些注释。 And it still happens and reverts back to the default code. 它仍然会发生并恢复为默认代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从Visual Studio 2015运行在Visual Studio 2013的SQL Server数据工具中开发的SSIS包 - Running an SSIS package developed in SQL Server Data Tools for Visual Studio 2013 from Visual Studio 2015 Visual Studio在哪里存储SQL Server数据工具中使用的数据连接字符串 - Where does Visual Studio store data connection strings used in SQL Server Data Tools Visual Studio 2015 SQL Server数据工具缺少“添加表”选项 - Visual Studio 2015 SQL Server Data Tools missing “Add Table” option 代码覆盖率工具和Visual Studio 2008 Pro - Code Coverage Tools & Visual Studio 2008 Pro Visual Studio 未从 Microsoft SQL Server Management Studio 加载数据 - Visual studio not loading data from Microsoft SQL Server Management Studio 在Visual Studio中使用数据连接来探索SQL Server Express数据库 - Using data connections in Visual Studio to explore SQL Server Express database 通过 DataGridView 将数据插入 SQL 服务器数据库在 Visual Studio 中不起作用 - Inserting Data Into SQL Server Database Through DataGridView Not Working In Visual Studio 在Visual Studio 2013中使用SqlCeResultSet进行SQL Server Compact Edition数据访问 - SQL Server Compact Edition Data Access with the SqlCeResultSet in Visual Studio 2013 SQL Server与Visual Studio通信 - SQL Server communicating with Visual Studio 将 SQL Server 链接到 Visual Studio - Link SQL Server to Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM