在创建SharePoint包之前运行的Visual Studio post build命令

时间:2011-04-05 16:20:39

标签: visual-studio-2010 sharepoint

我正在更新一些VS SharePoint项目,因此在构建它们时,会创建dll和wsp(包)。

我找到了描述该过程的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 ==========

有什么想法吗?感谢!!!

2 个答案:

答案 0 :(得分:1)

可以找到解决方案here

  

Visual Studio&amp; SharePoint:如何在构建过程中创建包   过程为了构建项目并创建包,这个   可以添加到项目文件(csproj,vbproj):

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

答案 1 :(得分:-3)

没错。构建装配后发生构建后事件。