在选中“发布时预编译"后,为什么我的msbuild部署不起作用?在发布属性上? [英] Why won't my msbuild deploy work after I check "Precompile during publishing" on the publish properties?
问题描述
我检查了中间选项,即发布时预编译".
I checked the middle option, below, "Precompile during publishing".
这将FDeploy.pubxml文件更改了几行.美好的.我将这一更改提交给了我的构建服务器.
This changed the FDeploy.pubxml file by a few lines. Fine. I committed this single change to my build server.
在这里发布pubxml:
Heres the pubxml:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\Temp</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
</PropertyGroup>
</Project>
启用了mvcbuildviews的远程构建已通过.远程部署失败,并显示以下错误:
The remote build with mvcbuildviews enabled passed. The remote deploy failed with errors like:
Error 82 The name 'ViewBag' does not exist in the current context
Error 5 The name 'model' does not exist in the current context
,依此类推.这样有超过100个错误.请记住,启用常规msbuildviews的msbuild步骤可以在相同的代码下正常工作.
and so on. There's over 100 errors like this. Keep in mind the regular msbuildviews enabled msbuild step worked fine with the same code.
我以这种方式在Web项目csproj上使用msbuild:
I use msbuild on the web project csproj this way:
/p:DeployOnBuild=true /p:PublishProfile=FDeploy /p:VisualStudioVersion=12.0 /p:Configuration=Release
有任何线索吗?哦,是的,选中该复选框也会在我的开发机上引起相同的错误,我必须完全删除bin,obj和appdata文件夹才能中和它.但是,在构建服务器上进行全新签出并没有帮助.
Any clues? Oh yeah, checking the box caused the same errors on my dev machine as well, I had to delete the bin, obj and appdata folders completely to neutralize it. However, doing a fresh checkout on the build server did not help.
还请注意,当我回到原来的部署配置文件时,它进行了新的签出以修复部署.
Also note that when I went back to my old deploy profile it took a fresh checkout to fix the deploy.
推荐答案
我不得不作弊以解决此问题:我将MvcBuildViews的使用仅限于项目的调试"版本:
I had to cheat to solve this problem: I restricted my use of MvcBuildViews to only the 'Debug' version of the project:
在csproj文件中:
In the csproj file:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<MvcBuildViews>true</MvcBuildViews>
</PropertyGroup>
在部署时,我使用mvcbuildviews遇到其他莫名其妙的错误.似乎最好避免完全使用它.无论如何,该构建仍然保持干净,因为我也编译并测试了调试版本.
I ran into other inexplicable errors using mvcbuildviews when deploying. Seems best to avoid using it altogether. Anyway, the build is still kept clean because I compile and test the debug version too.
这篇关于在选中“发布时预编译"后,为什么我的msbuild部署不起作用?在发布属性上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!