2011-04-05 150 views
2

我正在更新一些VS SharePoint項目,因此在構建它們時,會同時創建dll和wsp(包)。創建SharePoint包之前運行的Visual Studio後構建命令

我發現this頁描述的過程,但問題是,雖然我的項目文件看起來像這樣:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets" /> 
    <PropertyGroup> 
    <BuildDependsOn>$(BuildDependsOn);CreatePackage</BuildDependsOn> 
    </PropertyGroup> 
    <PropertyGroup> 
    <PostBuildEvent>"$(SolutionDir)PostBuild.cmd" "$(SolutionDir)" "$(TargetDir)"</PostBuildEvent> 
    </PropertyGroup> 

PostBuild.cmd運行前發生的包裝,所以開始清理時,這是輸出:

------ Rebuild All started: Project: Sample, Configuration: Debug Any CPU ------ 
    SampleProject -> C:\Inter\bin\Debug\Sample.dll 
    C:\Inter\bin\Debug\Sample.dll 
    1 File(s) copied 
    File not found - *.wsp 
    0 File(s) copied 
    Successfully created package at: C:\Inter\Sample\bin\Debug\Sample.wsp 
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ========== 

任何想法?謝謝!!!

回答

1

解決方法可以發現here

的Visual Studio &的SharePoint:如何爲構建 過程中創建的軟件包爲了構建一個項目,已經創建了包,這個 可以添加到項目文件(的csproj,vbproj):

<PostBuildEventDependsOn> 
    $(PostBuildEventDependsOn); 
    CreatePackage; 
</PostBuildEventDependsOn> 
-3

沒錯。 PostBuild事件發生在裝配後。

+0

當然......什麼,我在這裏發帖是PostBuild發生創建包... – Ariel 2011-04-06 11:45:39

+0

@Ariel BEFORE:我想告訴你,這是正確的行爲。如果你想在打包之前做任何事情,可以使用PreDeploymentCommand – vvk 2011-04-06 12:23:32

+0

但是我不想做部署,只打包AFTER build和BEFORE PostBuild事件,有意義嗎?我想單擊「重建」,並建立項目,打包,然後postbuild命令運行... – Ariel 2011-04-06 12:42:28

相關問題