public override async Task ExecuteAsync(ModuleInstallingContext context) { var _nugetSourceCodeStoreManager = context.ServiceProvider.GetRequiredService <INugetSourceCodeStore>(); var zipFilePath = await _nugetSourceCodeStoreManager.GetCachedSourceCodeFilePathAsync( context.ModuleName, SourceCodeTypes.Module, context.Version); if (zipFilePath == null) { throw new AbpStudioException(message: $"Source code not found for {context.ModuleName} (v{context.Version})"); } var targetFolder = context.GetTargetSourceCodeFolder(); if (Directory.Exists(targetFolder)) { return; } Directory.CreateDirectory(targetFolder); ZipFile.ExtractToDirectory(zipFilePath, targetFolder); }
private async Task AddReferenceAsync( ModuleInstallingContext context, PackageInfo targetPackage, PackageInfoWithAnalyze referencePackage) { var _csprojFileManager = context.ServiceProvider.GetRequiredService <ICsprojFileManager>(); var csprojFilePath = targetPackage.Path.RemovePostFix(PackageConsts.FileExtension) + ".csproj"; if (context.WithSourceCode) { var referenceProjectPath = Directory.GetFiles(context.GetTargetSourceCodeFolder(), $"*{referencePackage.Name}.csproj", SearchOption.AllDirectories).FirstOrDefault(); if (referenceProjectPath == null) { return; } await _csprojFileManager.AddProjectReferenceAsync( csprojFilePath, referenceProjectPath); } else { await _csprojFileManager.AddPackageReferenceAsync( csprojFilePath, referencePackage.Name, context.Version); } }
public async override Task ExecuteAsync(ModuleInstallingContext context) { var moduleFolder = Path.GetDirectoryName(context.TargetModule); var commonPropsFilePath = Path.Combine(moduleFolder, "common.props"); if (!File.Exists(commonPropsFilePath)) { return; } var _csprojFileManager = context.ServiceProvider.GetRequiredService <ICsprojFileManager>(); var csProjFiles = Directory.GetFiles(context.GetTargetSourceCodeFolder(), "*.csproj", SearchOption.AllDirectories); foreach (var csProjFile in csProjFiles) { await _csprojFileManager.AddAssemblyVersionAsync(csProjFile, context.Version); await _csprojFileManager.AddCopyLocalLockFileAssembliesAsync(csProjFile); } }