我想使用 Visual Web Developer Express 2010 发布一个网站,使用以下设置通过 FTP 预编译到远程服务器:
我的第一次构建/部署似乎进展顺利,但在第二次编译后,我收到以下错误:
Transformed web.config using C:\path_to_site\Web.Debug.config into obj\Debug\TransformWebConfig\transformed\web.config.
Copying all files to temporary location below for package/publish:
obj\Debug\AspnetCompileMerge\Source.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.5\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(132,5): Error : Can't find the valid AspnetMergePath
这是 Microsoft.Web.Publishing.AspNetConfigurationMerge.targets 文件内容的子集:
<Target
Name="GetAspNetMergePath"
DependsOnTargets="$(GetAspNetMergePathDependsOn)"
Condition ="'$(GetAspNetMergePath)' != 'false'">
<PropertyGroup>
<AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
<AspnetMergePath Condition="Exists('$(TargetFrameworkSDKToolsDirectory)$(AspnetMergeName)')">$(TargetFrameworkSDKToolsDirectory)</AspnetMergePath>
</PropertyGroup>
<Error Condition="'$(AspnetMergePath)' == '' Or !Exists($(AspnetMergePath))"
Text="Can't find the valid AspnetMergePath" />
</Target>
编辑:在发布之前更改发布设置以删除所有现有文件毕竟不能解决问题。因此,我假设问题现在是本地问题。
我的 web.config 中似乎没有 AspMergePath 标记。我不知道我是否应该手动添加标签。但是,我的项目中确实存在路径“obj{publish setting}\AspnetCompileMerge\Source”。
如果重要,我的项目名称是“TestProject.NET”
感谢您的反馈。
最佳答案
我遇到了同样的问题。搜索了所有与微软相关的网站,发现了很多提示,微软无意修复它。
在这里,我如何在我的系统中解决它。编辑 Microsoft.Web.Publishing.AspNetConfigurationMerge.targets
文件并添加以下行。请确保您的 PC 上的 Microsoft SDK 路径相同,如果不是,请更改它:
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\</TargetFrameworkSDKToolsDirectory>
它应该是这样的:
<Target
Name="GetAspNetMergePath"
DependsOnTargets="$(GetAspNetMergePathDependsOn)"
Condition ="'$(GetAspNetMergePath)' != 'false'">
<PropertyGroup>
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\</TargetFrameworkSDKToolsDirectory>
<AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
<AspnetMergePath Condition="Exists('$(TargetFrameworkSDKToolsDirectory)$(AspnetMergeName)')">$(TargetFrameworkSDKToolsDirectory)</AspnetMergePath>
</PropertyGroup>
<Error Condition="'$(AspnetMergePath)' == '' Or !Exists($(AspnetMergePath))"
Text="Can't find the valid AspnetMergePath" />
关于asp.net - "Can' t 在 Visual Web Developer Publish 上找到有效的 AspnetMergePath”?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12713714/