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



我正在更新一些VS SharePoint项目,所以当它们被构建时,dll和wsp的(包)都被创建。

我发现这个页面描述的过程,但问题是,虽然我的项目文件看起来像这样:

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

PostBuild。cmd在打包之前运行,所以当开始clean时,输出如下:

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

任何想法?谢谢! !

可以在这里找到解决方案。

Visual Studio &如何创建包作为构建的一部分为了构建一个项目并创建包,这可以添加到项目文件(csproj, vbproj):

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

没错。PostBuild事件发生在构建程序集之后。

最新更新