我正在尝试在我的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>
我尝试插入&lt; PostBuildEvent&gt;它看起来像这个
<?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根本不会触发。我在这里做错了什么?
答案 0 :(得分:1)
谁告诉你.dtproj支持&lt; PostBuildEvent&gt;? &LT; PostBuildEvent&GT;基于MSBUILD的项目支持,但.dtproj具有完全不同的模式,并且根本不了解PropertyGroup或PostBuildEvent标记。
如果您只想将.dtsx文件复制到c:\,如本示例所示 - 您可以将OutputPath更改为c:\,而.dtproj会将.dtsx文件(和配置)复制到c:\而不是默认情况下使用的bin \目录。
如果您需要更通用的解决方案,我会在解决方案中添加一些其他项目(支持&lt; PostBuildEvent&gt;),并在那里定义自定义命令。然后构建整个解决方案,而不是仅构建.dtproj项目。