@@ -38,14 +38,16 @@ public ScriptDependencyContextReader(LogFactory logFactory)
38
38
39
39
public ScriptDependencyContext ReadDependencyContext ( string pathToAssetsFile )
40
40
{
41
- var pathToProjectFile = GetPathToProjectFile ( pathToAssetsFile ) ;
42
- var projectFile = XDocument . Load ( pathToProjectFile ) ;
43
- var sdk = projectFile . Descendants ( "Project" ) . Single ( ) . Attributes ( "Sdk" ) . Single ( ) . Value ;
41
+ // var pathToProjectFile = GetPathToProjectFile(pathToAssetsFile);
42
+ // var projectFile = XDocument.Load(pathToProjectFile);
43
+ // var sdk = projectFile.Descendants("Project").Single().Attributes("Sdk").Single().Value;
44
44
45
45
var lockFile = GetLockFile ( pathToAssetsFile ) ;
46
+
46
47
// Since we execute "dotnet restore -r [rid]" we get two targets in the lock file.
47
48
// The second target is the one containing the runtime deps for the given RID.
48
49
var target = GetLockFileTarget ( lockFile ) ;
50
+
49
51
var targetLibraries = target . Libraries ;
50
52
var packageFolders = lockFile . PackageFolders . Select ( lfi => lfi . Path ) . ToArray ( ) ;
51
53
var userPackageFolder = packageFolders . First ( ) ;
@@ -72,7 +74,7 @@ public ScriptDependencyContext ReadDependencyContext(string pathToAssetsFile)
72
74
var netcoreAppRuntimeAssemblies = Directory . GetFiles ( netcoreAppRuntimeAssemblyLocation , "*.dll" ) . Where ( IsAssembly ) . ToArray ( ) ;
73
75
var netCoreAppDependency = new ScriptDependency ( "Microsoft.NETCore.App" , ScriptEnvironment . Default . NetCoreVersion . Version , netcoreAppRuntimeAssemblies , Array . Empty < string > ( ) , Array . Empty < string > ( ) , Array . Empty < string > ( ) ) ;
74
76
scriptDependencies . Add ( netCoreAppDependency ) ;
75
- if ( sdk == "Microsoft.NET.Sdk.Web" )
77
+ if ( File . ReadAllText ( pathToAssetsFile ) . Contains ( "Microsoft.AspNetCore.App" ) )
76
78
{
77
79
var aspNetCoreRuntimeInfo = GetAspNetCoreRuntimeInfo ( netcoreAppRuntimeAssemblyLocation ) ;
78
80
var aspNetCoreAppRuntimeAssemblies = Directory . GetFiles ( aspNetCoreRuntimeInfo . aspNetCoreRuntimeAssemblyLocation , "*.dll" ) . Where ( IsAssembly ) . ToArray ( ) ;
0 commit comments