2017-03-08 5 views
1

https://github.com/StackExchange/StackExchange.PrecompilationStackExchange.Precompilationを使用して相対パスのコンパイルを修正する方法はありますか?

私たちはStackExchange.Precompilationをインストールした別のライブラリにいくつかの共有ビューを持っています。これらのビューを通常のWebプロジェクトのビューと共にロードする必要があります。両方のプロジェクトでNuGetから最新のStackExchange.Precompilationがインストールされています。我々は返す、通常の方法をWebプロジェクトで

// Register precompiled view engine 
ViewEngines.Engines.Clear(); 

List<Assembly> viewAssemblies = new List<Assembly> { typeof(HomeController).Assembly }; 
viewAssemblies.AddRange(AppDomain.CurrentDomain.GetAssemblies().Where(a => a.FullName.ToLower().Contains(".web"))); 

Log.Debug().Message("Looking for views in: {0}", string.Join(", ", viewAssemblies.Select(a => a.FullName))).Write(); 

ViewEngines.Engines.Add(new PrecompiledViewEngine(viewAssemblies.ToArray())); 

ビュー:私はこのようなアセンブリの読み込みをしています

The view 'Index' or its master was not found or no view engine supports the searched locations. 
The following locations were searched: 
~/util/Views/Example/Index.cshtml 
~/util/Views/Shared/Index.cshtml 
PrecompiledViewEngineを使用して、我々はそのような相対的な名前をレンダリングしようとするとエラーが出る return View("Index");

utilは、IISのアプリケーションのエイリアスです。 エリアは登録されていません。

PrecompiledViewEngineクラスをGitHub - からコピーしたところ、! NuGetを使って配布されるバージョンを作るのに欠けていますか?

答えて

関連する問題