有没有更好的方法在 Web Deploy 发布中包含不属于项目的文件?
是的。Web 部署在部署(或打包)它们之前将您的 Web 应用程序的文件复制到一个临时文件夹。您最好的选择是挂钩该事件并将您的设置文件复制到临时目录结构中。
<!-- This goes in your publish profile (or ProjectName.wpp.targets if you don't
have the Azure SDK or VS 2012 installed) -->
<PropertyGroup>
<PipelineCollectFilesPhaseDependsOn>
CollectWindowsFormsApp;
$(PipelineCollectFilesPhaseDependsOn);
</PipelineCollectFilesPhaseDependsOn>
</PropertyGroup>
<Target Name="CollectWindowsFormsApp">
<ItemGroup>
<FilesForPackagingFromProject Include="$(SolutionDir)YourWindowsFormsApp\bin\debug\YourWindowsFormsApp.msi">
<DestinationRelativePath>App_Data\YourWindowsFormsApp.msi</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>