2017-12-20 8 views
0

Webデプロイメントメソッドを使用して、Webアプリケーションをテストサーバーにデプロイします。アプリケーションは問題なく正常に構築され、ローカルとテストサーバーで正常に動作します。デプロイ中にプリコンパイルされた設定を使用したいときに問題が発生します。このプロセスの途中で、VerifyCode.cshtmlファイルに大量のエラーがあります。私のビューフォルダにVerifyCodeというビューがありません。問題はどこだ?私は匿名とWindows認証を並行して使用しています。プリコンパイル済みビューを使用したwebappのデプロイ

公開マイセッティング: enter image description here enter image description here

例のエラー私は受け取って:

The name 'ViewBag' does not exist in the current context 
The name 'Scripts' does not exist in the current context 
The name 'Model' does not exist in the current context 
'HtmlHelper' does not contain a definition for 'TextBoxFor' ... 

のように...

VerifyCode.cshtmlコード:

@model App.Models.VerifyCodeViewModel 
@{ 
    ViewBag.Title = "Verify"; 
} 

<h2>@ViewBag.Title.</h2> 

@using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { 
    @Html.AntiForgeryToken() 
    @Html.Hidden("provider", @Model.Provider) 
    @Html.Hidden("rememberMe", @Model.RememberMe) 
    <h4>Enter verification code</h4> 
    <hr /> 
    @Html.ValidationSummary("", new { @class = "text-danger" }) 
    <div class="form-group"> 
     @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) 
     <div class="col-md-10"> 
      @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) 
     </div> 
    </div> 
    <div class="form-group"> 
     <div class="col-md-offset-2 col-md-10"> 
      <div class="checkbox"> 
       @Html.CheckBoxFor(m => m.RememberBrowser) 
       @Html.LabelFor(m => m.RememberBrowser) 
      </div> 
     </div> 
    </div> 
    <div class="form-group"> 
     <div class="col-md-offset-2 col-md-10"> 
      <input type="submit" class="btn btn-default" value="Submit" /> 
     </div> 
    </div> 
} 

@section Scripts { 
    @Scripts.Render("~/bundles/jqueryval") 
} 

答えて

0

私はそれを動作させることができた。問題は簡単でした。私はどのように考えているのですか?私のプロジェクトではランダムな場所にVerifyCodeという名前のビューがありました。

興味深い事実は、VS検索のテキストツールがそれを見つけることができなかったことです。私は少しの研究を行った。 hereとVSのテキスト検索でいくつかの問題があり、常に期待どおりに機能していないことがわかりました。

ビューがプリコンパイルされている間、すべてのビューファイルは、参照なしでこの卑劣なものと一緒に掻き集められました。

関連する問題