发布配置文件目标不是 运行 Visual Studio 2019 MVC 项目
Publish Profile Targets Not Running Visual Studio 2019 MVC Project
我正在努力做到这一点,所以当我部署我的 mvc web 应用程序时,app_offline 屏幕是第一个复制到服务器的项目(使用 web 部署到 azure vm),然后在部署过程文件被删除。
我遇到的问题是我的 pubxml 文件中的目标未被命中,下面是目标示例。我读过各种文章,这些文章表明这是解决此问题的正确方法,但我想知道此信息是否已过时或与 mvc 不兼容。
<Target Name="TakeOffline" AfterTargets="BeforePublish" >
<Message Text="Taking application offline" Importance="high" />
</Target>
<Target Name="RestoreOnline" AfterTargets="AfterPublish" >
<Message Text="Restoring application online" Importance="high" />
</Target>
我在发布 MVC 应用程序时遇到了同样的问题。似乎缺少 AfterTargets
和 BeforeTargets
参数的文档,但是此页面 https://docs.microsoft.com/en-au/visualstudio/msbuild/target-build-order?view=vs-2015 混合了不同的示例和一些反复试验,帮助我使其正常工作。
我使用的是 Visual Studio 2019 版 16.7.3、ASP.NET 4.8 和 MVC5 - 所有这些都具有截至撰写本文时的最新更新。这就是在我的 .pubxml 文件中使用 Web Deploy 对我有用的...
<Target Name="TakeOffline" BeforeTargets="MSDeployPublish" >
<Message Text="Taking application offline" Importance="high" />
[copy app_offline.htm to destination here]
</Target>
<Target Name="RestoreOnline" AfterTargets="MSDeployPublish" >
<Message Text="Restoring application online" Importance="high" />
[delete app_offline.htm from destination here]
</Target>
我正在努力做到这一点,所以当我部署我的 mvc web 应用程序时,app_offline 屏幕是第一个复制到服务器的项目(使用 web 部署到 azure vm),然后在部署过程文件被删除。
我遇到的问题是我的 pubxml 文件中的目标未被命中,下面是目标示例。我读过各种文章,这些文章表明这是解决此问题的正确方法,但我想知道此信息是否已过时或与 mvc 不兼容。
<Target Name="TakeOffline" AfterTargets="BeforePublish" >
<Message Text="Taking application offline" Importance="high" />
</Target>
<Target Name="RestoreOnline" AfterTargets="AfterPublish" >
<Message Text="Restoring application online" Importance="high" />
</Target>
我在发布 MVC 应用程序时遇到了同样的问题。似乎缺少 AfterTargets
和 BeforeTargets
参数的文档,但是此页面 https://docs.microsoft.com/en-au/visualstudio/msbuild/target-build-order?view=vs-2015 混合了不同的示例和一些反复试验,帮助我使其正常工作。
我使用的是 Visual Studio 2019 版 16.7.3、ASP.NET 4.8 和 MVC5 - 所有这些都具有截至撰写本文时的最新更新。这就是在我的 .pubxml 文件中使用 Web Deploy 对我有用的...
<Target Name="TakeOffline" BeforeTargets="MSDeployPublish" >
<Message Text="Taking application offline" Importance="high" />
[copy app_offline.htm to destination here]
</Target>
<Target Name="RestoreOnline" AfterTargets="MSDeployPublish" >
<Message Text="Restoring application online" Importance="high" />
[delete app_offline.htm from destination here]
</Target>