是否可以使用 SSIS 包 dtsConfig 文件的相对路径?

发布于 2024-07-07 15:58:07 字数 167 浏览 7 评论 0原文

我试图使我们的 SQL Server Integration Services 包尽可能可移植,但阻碍这一点的一件事是配置的路径始终是绝对路径,这使得测试和部署变得令人头疼。 有什么建议可以让这更容易管理吗?

另一个问题是,当另一个开发人员将包从源代码控制中获取时,路径是特定于开发人员计算机的。

I am trying to make our SQL Server Integration Services packages as portable as possible and the one thing that is preventing that is that the path to the config is always an absolute path, which makes testing and deployment a headache. Are there any suggestions for making this more manageble?

Another issue is when another developer gets the package out of source control the path is specific to the developers machine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

被你宠の有点坏 2024-07-14 15:58:07

如果您尝试使用 Visual Studio 执行包,那么配置文件路径将被硬编码在其中。 因此,如果您移动项目,则需要更改包设置中的路径。 为了避免这种情况,您可以使用环境变量选项来存储配置文件路径。 那么你只需要改变它。

但是,对于测试和部署,您可能应该使用 dtexec 实用程序来执行包。 为此制作一些批处理文件。 最好针对每个不同的环境使用一个。 这里的配置文件路径可以是相对的。

dtexec /File Package.dtsx /Conf configuration.dtsConfig

这是如果你的包位于文件系统上的话。 您还可以将它们存储在 SQL Server 中。 您还可以将配置存储在 SQL Server 中,这可以提供灵活性。

If you are trying to execute your packages using Visual Studio then the configuration file path will be hardcoded in there. So if you move your project around you'll need to change the path in the package settings. To avoid this you could use the Environment variable option to store the configuration file path. Then you'll only need to change that.

For testing and deployment however you should probably use the dtexec utility to execute your packages. Make some batch files for that. Preferably one for each different environment. Here the configuration file path can be relative.

dtexec /File Package.dtsx /Conf configuration.dtsConfig

This is if you're packages are on file system. You can also store them in SQL Server. You can also store your configuration in SQL Server which may provide flexibility.

屌丝范 2024-07-14 15:58:07

经过几个小时的努力,我找到了一个解决方案 此处(不是最好的,但它有效)

  1. 将配置文件(dtsconfig 文件)与解决方案文件(.sln 文件)放在同一目录中
  2. 始终打开您的解决方案双击解决方案文件(.sln 文件)。 这会将“工作文件夹”设置为解决方案所在的位置,您的配置文件将被正确读取

,否则相对路径对我不起作用。

After several hours trying to make this work I found a solution here (not the best one, but it works)

  1. Locate your configuration files (dtsconfig files) in the same directory as your solution file (.sln file)
  2. ALWAYS open your solution by double-clicking the solution file (.sln file). This will set the ‘working folder’ to be where the solution lives, your configuration file will be read correctly

Otherwise the relative paths did not work for me.

攀登最高峰 2024-07-14 15:58:07

查看无需 BIDS 即可编辑 SSIS 配置文件路径的免费实用程序:
http://ssisconfigeditor.codeplex.com/

Check out the free utility that can edit SSIS configuration file paths without BIDS:
http://ssisconfigeditor.codeplex.com/

乖乖兔^ω^ 2024-07-14 15:58:07

对于这类问题,我常用的标准技巧是映射驱动器。

通过使用映射网络驱动器 或使用 Subst(两种方法可以互换)。

例如,将包的位置映射到 N:\,然后在包内使用 N:\MyParentPackage.dtsx、N:\MyChildPackage.dtsx 的路径。 这些包可以位于不同计算机上不同文件夹中的完全不同的驱动器上,一旦将包位置映射到 N:\

我通常会在项目文件旁边放置一个脚本来映射驱动器,该脚本会映射驱动器之前可以轻松运行。 一个问题是,如果您在 VISTA - Win8 上使用 subst,请将其映射为提升和非提升。

我对 Visual Studio 项目中的文件引用使用相同的方法。 这种方法的唯一问题是,您用来解决开发环境中的太多问题,并且您将用完驱动器号。

My stock standard trick for these sorts of problems are mapping drives.

Either by using a mapped network drive or by using Subst (both methods are interchangable).

e.g. Map the location of your package to N:\ then inside your package use paths using N:\MyParentPackage.dtsx, N:\MyChildPackage.dtsx. The packages can be on totally different drives in different folders on different machines, it'll work once you map the package location to the N:\

I usually put a script along side the project files to map the drive, which maps the drive so it can be easily run before. One gotcha, if you're using subst on VISTA - Win8, map it for elevated and non-elevated.

I use the same approach for file references in Visual Studio projects. Only issue with this approach, you use to solve too many issues in your dev environment and you'll run out of drives letters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文