SSIS 项目中的后期构建

发布于 2024-08-01 14:20:12 字数 3028 浏览 4 评论 0原文

我正在尝试在我的 SSIS 项目中添加 PostBuildEvent 。 这是我的原始 .DTProj 文件,来自一个带有一个测试包的测试项目。

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ProductVersion>10.0.2531.0</ProductVersion>
  <SchemaVersion>9.0.1.0</SchemaVersion>
  <State>$base64$PFNvdXnRyb2xJbmZvPg==</State>
  <Database>
    <Name>PreBeforeDeployTest.database</Name>
    <FullPath>PreBeforeDeployTest.database</FullPath>
  </Database>
  <Cubes />
  <Dimensions />
  <DataSources />
  <DataSourceViews />
  <MiningModels />
  <Roles />
  <Miscellaneous />
  <Configurations>
    <Configuration>
      <Name>Development</Name>
      <Options>
        <OutputPath>bin</OutputPath>
        <ConnectionMappings />
        <ConnectionProviderMappings />
        <ConnectionSecurityMappings />
        <DatabaseStorageLocations />
      </Options>
    </Configuration>
  </Configurations>
  <DTSPackages>
    <DtsPackage FormatVersion="3">
      <Name>TestPackage.dtsx</Name>
      <FullPath>TestPackage.dtsx</FullPath>
      <References />
    </DtsPackage>
  </DTSPackages>
</Project>

我尝试插入; 看起来像这样

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <PropertyGroup>
    <PostBuildEvent>copy "$(TargetDir)TestPackage.dtsx" "C:\"</PostBuildEvent> 
  </PropertyGroup>
  <ProductVersion>10.0.2531.0</ProductVersion>
  <SchemaVersion>9.0.1.0</SchemaVersion>
  <State>$base64$PFNvdXnRyb2xJbmZvPg==</State>
  <Database>
    <Name>PreBeforeDeployTest.database</Name>
    <FullPath>PreBeforeDeployTest.database</FullPath>
  </Database>
  <Cubes />
  <Dimensions />
  <DataSources />
  <DataSourceViews />
  <MiningModels />
  <Roles />
  <Miscellaneous />
  <Configurations>
    <Configuration>
      <Name>Development</Name>
      <Options>
        <OutputPath>bin</OutputPath>
        <ConnectionMappings />
        <ConnectionProviderMappings />
        <ConnectionSecurityMappings />
        <DatabaseStorageLocations />
      </Options>
    </Configuration>
  </Configurations>
  <DTSPackages>
    <DtsPackage FormatVersion="3">
      <Name>TestPackage.dtsx</Name>
      <FullPath>TestPackage.dtsx</FullPath>
      <References />
    </DtsPackage>
  </DTSPackages>
</Project>

PostBuildEvent 根本不会触发。 我在这里做错了什么?

I am trying to have a PostBuildEvent in my SSIS project. This is my original .DTProj file from a test project with one test package.

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ProductVersion>10.0.2531.0</ProductVersion>
  <SchemaVersion>9.0.1.0</SchemaVersion>
  <State>$base64$PFNvdXnRyb2xJbmZvPg==</State>
  <Database>
    <Name>PreBeforeDeployTest.database</Name>
    <FullPath>PreBeforeDeployTest.database</FullPath>
  </Database>
  <Cubes />
  <Dimensions />
  <DataSources />
  <DataSourceViews />
  <MiningModels />
  <Roles />
  <Miscellaneous />
  <Configurations>
    <Configuration>
      <Name>Development</Name>
      <Options>
        <OutputPath>bin</OutputPath>
        <ConnectionMappings />
        <ConnectionProviderMappings />
        <ConnectionSecurityMappings />
        <DatabaseStorageLocations />
      </Options>
    </Configuration>
  </Configurations>
  <DTSPackages>
    <DtsPackage FormatVersion="3">
      <Name>TestPackage.dtsx</Name>
      <FullPath>TestPackage.dtsx</FullPath>
      <References />
    </DtsPackage>
  </DTSPackages>
</Project>

I have tried inserting <PostBuildEvent> and it looks like this

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <PropertyGroup>
    <PostBuildEvent>copy "$(TargetDir)TestPackage.dtsx" "C:\"</PostBuildEvent> 
  </PropertyGroup>
  <ProductVersion>10.0.2531.0</ProductVersion>
  <SchemaVersion>9.0.1.0</SchemaVersion>
  <State>$base64$PFNvdXnRyb2xJbmZvPg==</State>
  <Database>
    <Name>PreBeforeDeployTest.database</Name>
    <FullPath>PreBeforeDeployTest.database</FullPath>
  </Database>
  <Cubes />
  <Dimensions />
  <DataSources />
  <DataSourceViews />
  <MiningModels />
  <Roles />
  <Miscellaneous />
  <Configurations>
    <Configuration>
      <Name>Development</Name>
      <Options>
        <OutputPath>bin</OutputPath>
        <ConnectionMappings />
        <ConnectionProviderMappings />
        <ConnectionSecurityMappings />
        <DatabaseStorageLocations />
      </Options>
    </Configuration>
  </Configurations>
  <DTSPackages>
    <DtsPackage FormatVersion="3">
      <Name>TestPackage.dtsx</Name>
      <FullPath>TestPackage.dtsx</FullPath>
      <References />
    </DtsPackage>
  </DTSPackages>
</Project>

The PostBuildEvent does not fire at all. What am I doing wrong here?

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

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

发布评论

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

评论(1

人│生佛魔见 2024-08-08 14:20:12

谁告诉你 .dtproj 支持的? <构建后事件> 基于 MSBUILD 的项目支持,但 .dtproj 具有完全不同的架构,并且根本不知道 PropertyGroup 或 PostBuildEvent 标记。

如果您只想将 .dtsx 文件复制到 c:\,如本示例所示 - 您可以将 OutputPath 更改为 c:\,并且 .dtproj 会将 .dtsx 文件(和配置)复制到 c:\ 而不是 bin\默认使用的目录。

如果您需要更通用的解决方案,我会向解决方案添加一些其他项目(支持),并在那里定义自定义命令。 然后构建整个解决方案,而不是仅构建 .dtproj 项目。

Who told you .dtproj supports <PostBuildEvent>? <PostBuildEvent> is supported by MSBUILD-based projects, but .dtproj has completely different schema, and simply does not know about PropertyGroup or PostBuildEvent tags.

If you just want to copy .dtsx files to c:\, as in this sample - you can change the OutputPath to c:\, and .dtproj will copy the .dtsx files (and configs) to c:\ instead of bin\ directory it used by default.

If you need more general solution, I would add some other project (that does support <PostBuildEvent>) to the solution, and define custom commands there. Then build the whole solution, instead of building just .dtproj project.

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