【问题标题】:Azure: Include unreferenced DLLs when publishAzure:发布时包含未引用的 DLL
【发布时间】:2018-01-10 04:30:03
【问题描述】:

我正在努力发布我的项目,因为缺少一些 DLL。经过一番调查,我找到了我要找的东西:

http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx

这是我的代码:

  <Target Name="CustomCollectFiles">
    <Message Text="Publishing unreferenced DLLs" Importance="High" />
    <ItemGroup>
      <_CustomFiles Include="$(UnreferencedDlls)" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>

它现在工作正常,但只有当我在本地发布时。当我尝试在 Azure 上发布时,这些相同的 DLL 丢失了。所以我尝试添加以下行:

<DestinationRelativePath>obj\Release\Package\PackageTmp\bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>

因为当我在 azure 上发布时,输出显示:

将所有文件复制到下面的临时位置以进行打包/发布:
obj\Release\Package\PackageTmp.

但是,DLL 仍然丢失,我不知道在 Azure 上发布时如何添加它们。

【问题讨论】:

  • 您是否通过以下代码将自定义目标注入CopyAllFilesToSingleFolder&lt;PropertyGroup&gt; &lt;CopyAllFilesToSingleFolderForPackageDependsOn&gt; CustomCollectFiles; $(CopyAllFilesToSingleFolderForPackageDependsOn); &lt;/CopyAllFilesToSingleFolderForPackageDependsOn&gt; ...?查看详细信息:docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/…

标签: visual-studio msbuild


【解决方案1】:

我找到了解决办法。第一个在我在本地计算机上部署时添加 DLL,第二个在 Azure 上部署应用程序时执行相同的操作。

  <PropertyGroup>
    <!-- Publish on the FILE SYSTEM -->
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>

    <!-- Publish on AZURE: Web Deploy -->
    <CopyAllFilesToSingleFolderForMSDeployDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForMSDeployDependsOn);
    </CopyAllFilesToSingleFolderForMSDeployDependsOn>
  </PropertyGroup>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-01
    相关资源
    最近更新 更多