我正在使用 Visual Studio 2015 的 Web 部署功能将我的 Type Script SPA 项目部署到我的登台服务器。
我希望部署过程将一些特定于部署的文件从我的项目的/Deployment 文件夹复制(并重命名)到项目的其他特定位置。
一个这样的例子是:
[project_root]/Deployment/index.remote.debug.html ---> [project_root]/index.html
我设法使用发布配置文件 (.pubxml) 中的以下部分实现了这一点:
<Target Name="index_html">
<ItemGroup>
<_CustomFiles Include="Deployment/index.remote.debug.html" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>index.html</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<Target Name="extractor_config">
<ItemGroup>
<_CustomFiles Include="Deployment/extractor.config.remote.debug.js" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>extractor.config.js</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
index_html;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForPackageDependsOn>
extractor_config;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
但这仅在使用“文件系统”选项发布到文件系统时才有效。
使用“Web 部署”选项发布到我的登台服务器时,我看不到任何效果。
应用程序已正确部署,但相应的文件不会被复制/重命名。
Visual Studio 输出中也没有与此类 Web 部署相关的错误消息。
如果我以非管理员或管理员身份部署,这没有区别。
有谁知道,问题出在哪里?
关于 MSBuild,我完全是外行,这是我第一次遇到。我只是在其他人的在线体验的帮助下才将其放在一起。
最佳答案
您需要一个名称略有不同的元素。你有:
<CopyAllFilesToSingleFolderForPackageDependsOn>
index_html;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForPackageDependsOn>
extractor_config;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
尝试使用几乎相同的部分,但带有此标签:
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
注意是 ForMsdeploy 不是 ForPackage
关于deployment - CopyAllFilesToSingleFolderForPackageDependsOn 和 Web 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35000825/