fly 2 years ago
parent
commit
2a2a186006

+ 4 - 14
Publish.ps1

@@ -14,20 +14,17 @@ Function BuildService($serviceName, $copyDll, $copyXml=0, $servicePath='', $copy
     dotnet publish "$servicePath/$serviceName.csproj" -c Debug
     if($copyDll -eq 1)
     {
-        Copy-Item -recurse -Force $servicePath/bin/Debug/net6.0/publish/$serviceName.dll -Destination $copyDest/Services/$serviceName.dll
-        Copy-Item -recurse -Force $servicePath/bin/Debug/net6.0/publish/*.dll -Destination $copyDest/Dependencies/ -Exclude $serviceName.dll         
+        Copy-Item -recurse -Force $servicePath/bin/Debug/net6.0/publish/$serviceName.dll -Destination $copyDest/$serviceName.dll     
     }
     if($copyXml -eq 1)
     {
-        Copy-Item -recurse -Force $servicePath/bin/Debug/net6.0/publish/$serviceName.xml -Destination $copyDest/Services/$serviceName.xml
-        Copy-Item -recurse -Force $servicePath/bin/Debug/net6.0/publish/*.xml -Destination $copyDest/Dependencies/ -Exclude $serviceName.xml         
+        Copy-Item -recurse -Force $servicePath/bin/Debug/net6.0/publish/$serviceName.xml -Destination $copyDest/$serviceName.xml     
     }
 }
 
 ### server
-IF (-not(Test-Path ../WingCloudServer/src/bin/Debug/net6.0/Dependencies/)) { New-Item -Path ../WingCloudServer/src/bin/Debug/net6.0/ -Name Dependencies -Type Directory -force }
-IF (-not(Test-Path ../WingCloudServer/src/bin/Debug/net6.0/Services/)) { New-Item -Path ../WingCloudServer/src/bin/Debug/net6.0/ -Name Services -Type Directory -force }
-BuildService "WingServerCommon" 0 0 "../WingServerCommon"
+
+BuildService "WingServerCommon" 1 0 "../WingServerCommon"
 BuildService "WingInterfaceLibrary" 0 1
 BuildService "WingNotificationModule" 1 0 "../WingNotificationModule"
 BuildService "WingMongoDBModule" 1
@@ -45,21 +42,14 @@ Copy-Item ../WingEmailModule/src/bin/Debug/net6.0/EmailTemplate/* -Destination .
 
 BuildService "WingUserModule" 1
 
-IF (-not(Test-Path ../wing/server/RegionData/)) { New-Item -Path ../WingCloudServer/src/bin/Debug/net6.0/ -Name RegionData -Type Directory -force }
-Copy-Item ../WingUserModule/src/bin/Debug/net6.0/Region/* -Destination ../WingCloudServer/src/bin/Debug/net6.0/RegionData
-
 BuildService "WingManagementModule" 1
 
-
 BuildService "WingDeviceService" 1 0 "../WingDeviceService"
 
-
 BuildService "ReportService" 1 0 "../WingReportService/ReportService"
 
 BuildService "WingRemedicalModule" 1
 
-Copy-Item -recurse -Force ../WingServerCommon/bin/Debug/net6.0/publish/WingServerCommon.dll -Destination ../WingCloudServer/src/bin/Debug/net6.0/WingServerCommon.dll
-Copy-Item -recurse -Force ../WingServerCommon/bin/Debug/net6.0/publish/WingServerCommon.dll -Destination ../WingCloudServer/src/bin/Debug/net6.0/Dependencies/WingServerCommon.dll
 
 Write-Host 'Finished!' -NoNewline
 $null = [Console]::ReadKey('?')

+ 0 - 1
src/Dependencies/Readme.txt

@@ -1 +0,0 @@
-此文件夹用于存放依赖类库

+ 25 - 25
src/Loader/AssemblyLoader.cs

@@ -19,31 +19,31 @@ namespace WingCloudServer
         public Assembly LoadAssemblyDependencies(string assemblyPath)
         {
             _assemblyDependencyResolver = new AssemblyDependencyResolver(Path.GetDirectoryName(assemblyPath));
-            AssemblyLoadContext.Default.Resolving += (assemblyLoadContext, assemblyName) =>
-            {
-                var path = _assemblyDependencyResolver.ResolveUnmanagedDllToPath(assemblyName.FullName);
-                if(string.IsNullOrWhiteSpace(path))
-                {
-                    path = Path.Combine(Path.GetDirectoryName(assemblyPath), assemblyName.Name+".dll");
-                }
-                if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
-                {
-                    path = FindDependencyByInternalServiceDir(assemblyName.Name);
-                }
-                if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
-                {
-                    path = FindDependencyByNetServiceDir(assemblyName.Name);
-                }
-                if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
-                {
-                    path = FindDependencyByRootDir(assemblyName.Name);
-                }
-                if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
-                {
-                    return null;
-                }
-                return AssemblyLoadContext.Default.LoadFromStream(File.OpenRead(path));
-            };
+            // AssemblyLoadContext.Default.Resolving += (assemblyLoadContext, assemblyName) =>
+            // {
+            //     var path = _assemblyDependencyResolver.ResolveUnmanagedDllToPath(assemblyName.FullName);
+            //     if(string.IsNullOrWhiteSpace(path))
+            //     {
+            //         path = Path.Combine(Path.GetDirectoryName(assemblyPath), assemblyName.Name+".dll");
+            //     }
+            //     if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
+            //     {
+            //         path = FindDependencyByInternalServiceDir(assemblyName.Name);
+            //     }
+            //     if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
+            //     {
+            //         path = FindDependencyByNetServiceDir(assemblyName.Name);
+            //     }
+            //     if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
+            //     {
+            //         path = FindDependencyByRootDir(assemblyName.Name);
+            //     }
+            //     if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
+            //     {
+            //         return null;
+            //     }
+            //     return AssemblyLoadContext.Default.LoadFromStream(File.OpenRead(path));
+            // };
             var assembly = AssemblyLoadContext.Default.LoadFromStream(File.OpenRead(assemblyPath));
             return assembly;
         }

+ 2 - 2
src/WingApplicationBuilder.cs

@@ -28,10 +28,10 @@ namespace WingCloudServer
         internal WingApplication Build()
         {           
             //=========================================================================//
-            /// TODO workaround fixed, we need  a better solution
+            // TODO workaround fixed, we need  a better solution
             AssemblyLoadContext.Default.Resolving += (a,b)=>{
                 //自定义依赖文件存放路径
-                var dependenciesPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Dependencies");
+                var dependenciesPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AIDiagnosis");
                 return Assembly.LoadFrom(Path.Combine(dependenciesPath, $"{b.Name}.dll"));
             };
             //=========================================================================//         

+ 2 - 0
src/WingCloudServer.csproj

@@ -9,6 +9,8 @@
     <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="5.0.0" />
     <PackageReference Include="WingInterfaceLibrary" Version="1.0.6.3" />
     <PackageReference Include="WingServerCommon" Version="1.0.0.26" />
+    <PackageReference Include="SkiaSharp" Version="1.68.2.1" />
+    <PackageReference Include="WingArtificialIntelligence" Version="1.0.0.2" />
   </ItemGroup>
   
   <ItemGroup>

+ 4 - 4
src/WingServer.cs

@@ -58,7 +58,7 @@ namespace WingCloudServer
             var rpcClientPool = new JsonRpcClientPool(_inProcessEngine);            
             rpcClientPool.Initialize(remoteRpcHttpServices.ToArray());
 
-            var folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Services");
+            var folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
             var inProcessServicesString = ConfigurationManager.GetParammeter<StringParameter>("Services", "InProcess").Value;
             var inProcessServices = inProcessServicesString.Split(',');
             var rpcHttpServicesString = ConfigurationManager.GetParammeter<StringParameter>("Services", "JsonRpcHttp").Value;
@@ -67,7 +67,7 @@ namespace WingCloudServer
             {
                 throw new NotSupportedException($"Folder {folder} not exist");
             }
-            InitAIDiagnosis();
+            //InitAIDiagnosis();
 
             //InProcess service load and register to InPrcess rpc server
             var rpcServices = new Dictionary<Type, object>();
@@ -152,7 +152,7 @@ namespace WingCloudServer
             }
 
             //load extdll
-            InitSkiaSharp(); //TODO should not copy skiasharp dll here
+            //InitSkiaSharp(); //TODO should not copy skiasharp dll here
         }
 
         private Type LoadService(string folder, object serviceName)
@@ -181,7 +181,7 @@ namespace WingCloudServer
         private Dictionary<string, List<string>> GetServiceByModuleName(string defaultInterfaceName = "WingInterfaceLibrary", string defaultInterfaceFolder = "Interface")
         {
             var dic = new Dictionary<string, List<string>>();
-            var folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Dependencies");
+            var folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
             if (!Directory.Exists(folder))
             {
                 throw new NotSupportedException($"Folder {folder} not exist");