我想使用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
Run Code Online (Sandbox Code Playgroud)
这是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>
Run Code Online (Sandbox Code Playgroud)
编辑:更改发布设置以在发布之前删除所有现有文件毕竟不能解决问题.因为这个原因,我现在假设问题是本地的.
我的web.config中似乎没有AspMergePath标记.我不知道我是否应该手动添加标签.但是,我的项目中存在路径"obj {publish setting}\AspnetCompileMerge\Source".
如果重要,我的项目名称是"TestProject.NET"
感谢您的反馈.
asp.net deployment visual-web-developer publishing visual-studio
不重复: MVC Razor动态模型,'object'不包含'PropertyName'的定义
根据那里的答案,
根据David Ebbo的说法,您无法将匿名类型传递给动态类型视图,因为匿名类型被编译为内部类型.由于CSHTML视图被编译为单独的程序集,因此无法访问匿名类型的属性.
为什么下面的代码 - 据说应该永远不会工作 - 按照我预期的部分视图位于"/Home/_Partial.cshtml"时工作,但在移动到"/Shared/_Partial.cshtml"时突然停止工作?
使用ASP.NET 4.5(和以前的版本),下面生成文本"Hello,World!" 到网络浏览器:
〜/控制器/ HomeController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace TestDynamicModel.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
Run Code Online (Sandbox Code Playgroud)
〜/浏览/首页/ Index.cshtml
@Html.Partial("_Partial", new { Text = "Hello, world!", ShouldRender = true } )
Run Code Online (Sandbox Code Playgroud)
〜/浏览/首页/ _Partial.cshtml
@model dynamic
@if (!Model.ShouldRender)
{
<p>Nothing to see here!</p>
}
else
{
<p>@Model.Text</p>
}
Run Code Online (Sandbox Code Playgroud)
但是,当_Partial.cshtml转移到〜/ Views/Shared/_Partial.cshtml时,_Partial.cshtml(第2行)中会抛出以下错误:
'object' does not contain …Run Code Online (Sandbox Code Playgroud)