【发布时间】:2015-11-03 15:46:34
【问题描述】:
有时,当我发布 ASP.NET MVC 应用程序并将文件复制到生产服务器时,我会收到 404 错误。当我检查新发布的站点和旧站点之间的差异时,我发现缺少一些文件,包括 App_global.asax.dll 和 App_global.asax.compiled。
这发生在 Visual Studio 2015 和以前的版本中。以前的出版物是成功的,但这似乎是断断续续的。在构建过程中不会产生任何错误。通过 MSBuild 发布和通过 Visual Studio 发布似乎都有同样的问题。有些日子,系统会构建得很好。有些日子,它不会。当我在发布之前删除包目录的内容时,这似乎最容易发生。
一个简单的示例 MSBuild 命令。这是一个非常简单的单站点 .csproj 文件。
MSBuild.exe \MyProject.csproj /p:DeployOnBuild=true;PublishProfile=Prod
发布档案:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>C:\packages\MyProject</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
</PropertyGroup>
</Project>
【问题讨论】:
标签: asp.net-mvc msbuild web-deployment antivirus