@@ -414,9 +414,10 @@ private void PackageMacros(PackageDefinition definition, XContainer root)
414
414
415
415
root . Add ( macros ) ;
416
416
417
- // get the partial views for macros and package those
418
- IEnumerable < string > views = packagedMacros . Select ( x => x . MacroSource ) . Where ( x => x . EndsWith ( ".cshtml" ) ) ;
419
- PackageMacroPartialViews ( views , root ) ;
417
+ // Get the partial views for macros and package those (exclude views outside of the default directory, e.g. App_Plugins\*\Views)
418
+ IEnumerable < string > views = packagedMacros . Where ( x => x . MacroSource . StartsWith ( Constants . SystemDirectories . MacroPartials ) )
419
+ . Select ( x => x . MacroSource . Substring ( Constants . SystemDirectories . MacroPartials . Length ) . Replace ( '/' , '\\ ' ) ) ;
420
+ PackageStaticFiles ( views , root , "MacroPartialViews" , "View" , _fileSystems . MacroPartialsFileSystem ) ;
420
421
}
421
422
422
423
private void PackageStylesheets ( PackageDefinition definition , XContainer root )
@@ -487,33 +488,6 @@ private void PackageTemplates(PackageDefinition definition, XContainer root)
487
488
root . Add ( templatesXml ) ;
488
489
}
489
490
490
- private void PackageMacroPartialViews ( IEnumerable < string > viewPaths , XContainer root )
491
- {
492
- var viewsXml = new XElement ( "MacroPartialViews" ) ;
493
- foreach ( var viewPath in viewPaths )
494
- {
495
- // TODO: See TODO note in MacrosController about the inconsistencies of usages of partial views
496
- // and how paths are saved. We have no choice currently but to assume that all views are 100% always
497
- // on the content path.
498
-
499
- var physicalPath = _hostingEnvironment . MapPathContentRoot ( viewPath ) ;
500
- if ( ! File . Exists ( physicalPath ) )
501
- {
502
- throw new InvalidOperationException ( "Could not find partial view at path " + viewPath ) ;
503
- }
504
-
505
- var fileContents = File . ReadAllText ( physicalPath , Encoding . UTF8 ) ;
506
-
507
- viewsXml . Add (
508
- new XElement (
509
- "View" ,
510
- new XAttribute ( "path" , viewPath ) ,
511
- new XCData ( fileContents ) ) ) ;
512
- }
513
-
514
- root . Add ( viewsXml ) ;
515
- }
516
-
517
491
private void PackageDocumentTypes ( PackageDefinition definition , XContainer root )
518
492
{
519
493
var contentTypes = new HashSet < IContentType > ( ) ;
0 commit comments