diff --git a/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj b/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj index 5538bfe..c054aa7 100644 --- a/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj +++ b/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj @@ -26,6 +26,7 @@ + diff --git a/Fab2ApprovalSystem/Controllers/ECNController.cs b/Fab2ApprovalSystem/Controllers/ECNController.cs index 757cf3b..bd86104 100644 --- a/Fab2ApprovalSystem/Controllers/ECNController.cs +++ b/Fab2ApprovalSystem/Controllers/ECNController.cs @@ -1159,6 +1159,8 @@ public class ECNController : PdfViewController { public ActionResult CancelDocument(int ecnNumber, byte currentStep, int documentType, string ecnTypeString, string comments = "") { ECN ecn = ecnDMO.GetECN(ecnNumber); bool lastApproverAndLastStep = false; + if (ecn.SubmitedDate is not null && currentStep >= 1) + wfDMO.Approve(_AppSettings, ecnNumber, currentStep, comments, out bool lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType, ecn.WorkFlowNumber); int appoverCount = ecnDMO.SubmitForCancellation(ecnNumber, (byte)GlobalVars.WorkFLowStepNumber.Step1, (int)Session[GlobalVars.SESSION_USERID], documentType, ecnTypeString, (int)GlobalVars.TECNExpirationCancellation.Cancellation); if (appoverCount > 0) { NotifyApproversForCancellation(ecnNumber, ecn, currentStep, documentType, ecnTypeString); diff --git a/Fab2ApprovalSystem/Misc/ExcelData.cs b/Fab2ApprovalSystem/Misc/ExcelData.cs index 7ced44c..7159114 100644 --- a/Fab2ApprovalSystem/Misc/ExcelData.cs +++ b/Fab2ApprovalSystem/Misc/ExcelData.cs @@ -1,104 +1,109 @@ -#if !NET8 +#if NET8 + +using ExcelDataReader; + +#else using Excel; +#endif + using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; -using System.Web; -namespace Fab2ApprovalSystem.Misc { +namespace Fab2ApprovalSystem.Misc; - public class ExcelData { - string _path; - public ExcelData(string path) { - _path = path; - } +public class ExcelData { - public IExcelDataReader getExcelReader() { - // ExcelDataReader works with the binary Excel file, so it needs a FileStream - // to get started. This is how we avoid dependencies on ACE or Interop: - - FileStream stream = File.Open(_path, FileMode.Open, FileAccess.Read); - // We return the interface, so that - IExcelDataReader reader = null; - - try { - if (_path.EndsWith(".xls")) { - reader = ExcelReaderFactory.CreateBinaryReader(stream); - } - if (_path.EndsWith(".xlsx")) { - reader = ExcelReaderFactory.CreateOpenXmlReader(stream); - } - return reader; - } catch (Exception) { - throw; - } - - } - - public class ExcelLotInfo { - public string LotNo { get; set; } - public string LotDispo { get; set; } - } - - public IEnumerable ReadData() { - var r = new List(); - var excelData = new ExcelData(_path); - var lots = excelData.getData().ToList(); - - int lotDispoColumnIndex = -1; - foreach (DataColumn col in lots[0].Table.Columns) { - if (col.ColumnName.ToLower().Contains("dispo")) { - lotDispoColumnIndex = col.Ordinal; - break; - } - } - - foreach (var row in lots) { - string temValue = row[0].ToString(); - if (temValue.Trim().Length > 0 && temValue.Trim().Length <= 10) { - r.Add(new ExcelLotInfo() { - LotNo = row[0].ToString(), - LotDispo = (lotDispoColumnIndex >= 0 ? row[lotDispoColumnIndex].ToString() : "") - }); - } - - } - return r; - } - - public IEnumerable ReadQDBFlagData() { - List s = new List(); - // We return the interface, so that - var excelData = new ExcelData(_path); - var lotNos = excelData.getData(); - foreach (var row in lotNos) { - string temValue = row[0].ToString(); - if (temValue.Trim().Length > 0 && temValue.Trim().Length == 9) { - if (row[2].ToString().ToUpper() != "YES" && row[2].ToString().ToUpper() != "NO") { - throw new Exception("Invalid data in the file"); - } else { - s.Add(row[0].ToString() + "~" + row[1] + "~" + row[2]); - } - } - - } - return s; - } - - public IEnumerable getData(bool firstRowIsColumnNames = true) { - var reader = this.getExcelReader(); - reader.IsFirstRowAsColumnNames = firstRowIsColumnNames; - var workSheet = reader.AsDataSet().Tables[0]; - var rows = from DataRow a in workSheet.Rows select a; - return rows; - - } + private readonly string _Path; + public ExcelData(string path) { + _Path = path; } -} -#endif \ No newline at end of file + public IExcelDataReader getExcelReader() { + FileStream stream = File.Open(_Path, FileMode.Open, FileAccess.Read); + IExcelDataReader reader = null; + try { + if (_Path.EndsWith(".xls")) { + reader = ExcelReaderFactory.CreateBinaryReader(stream); + } + if (_Path.EndsWith(".xlsx")) { + reader = ExcelReaderFactory.CreateOpenXmlReader(stream); + } + return reader; + } catch (Exception) { + throw; + } + } + + public class ExcelLotInfo { + public string? LotNo { get; set; } + public string? LotDispo { get; set; } + } + + public IEnumerable ReadData() { + List r = new(); + ExcelData excelData = new(_Path); + List lots = excelData.getData().ToList(); + + int lotDispoColumnIndex = -1; + foreach (DataColumn col in lots[0].Table.Columns) { + if (col.ColumnName.ToLower().Contains("dispo")) { + lotDispoColumnIndex = col.Ordinal; + break; + } + } + + foreach (DataRow row in lots) { + string temValue = row[0].ToString(); + if (temValue.Trim().Length > 0 && temValue.Trim().Length <= 10) { + r.Add(new ExcelLotInfo() { + LotNo = row[0].ToString(), + LotDispo = (lotDispoColumnIndex >= 0 ? row[lotDispoColumnIndex].ToString() : "") + }); + } + + } + return r; + } + + public IEnumerable ReadQDBFlagData() { + List s = new(); + ExcelData excelData = new(_Path); + IEnumerable lotNos = excelData.getData(); + foreach (DataRow row in lotNos) { + string temValue = row[0].ToString(); + if (temValue.Trim().Length > 0 && temValue.Trim().Length == 9) { + if (row[2].ToString().ToUpper() != "YES" && row[2].ToString().ToUpper() != "NO") { + throw new Exception("Invalid data in the file"); + } else { + s.Add(row[0].ToString() + "~" + row[1] + "~" + row[2]); + } + } + + } + return s; + } + +#if NET8 + + public IEnumerable getData(bool firstRowIsColumnNames = true) => + throw new NotImplementedException(); + +#else + + public IEnumerable getData(bool firstRowIsColumnNames = true) { + IExcelDataReader reader = getExcelReader(); + reader.IsFirstRowAsColumnNames = firstRowIsColumnNames; + var workSheet = reader.AsDataSet().Tables[0]; + var rows = from DataRow a in workSheet.Rows select a; + return rows; + } + +#endif + +} \ No newline at end of file diff --git a/Fab2ApprovalSystem/Misc/LotDispositionHelper.cs b/Fab2ApprovalSystem/Misc/LotDispositionHelper.cs index ab216d8..0b79d6b 100644 --- a/Fab2ApprovalSystem/Misc/LotDispositionHelper.cs +++ b/Fab2ApprovalSystem/Misc/LotDispositionHelper.cs @@ -117,8 +117,8 @@ public class LotDispositionHelper { public static void AttachSave(AppSettings appSettings, LotDispositionDMO lotDispositionDMO, int issueID, int userId, string fullFileName, Stream stream) { // Some browsers send file names with full path. // We are only interested in the file name. - var fileName = Path.GetFileName(fullFileName); - var physicalPath = Path.Combine(appSettings.AttachmentFolder + "LotDisposition", fileName); + string fileName = Path.GetFileName(fullFileName); + string physicalPath = Path.Combine(appSettings.AttachmentFolder + "LotDisposition", fileName); using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) { stream.CopyTo(fileStream); @@ -134,7 +134,7 @@ public class LotDispositionHelper { public static string ExcelLotOpen(LotDispositionDMO lotDispositionDMO, int issueID, string userIdentityName, string lotTempPipeLine, string fullFileName, Stream stream) { string physicalPath; - var fileExtension = Path.GetExtension(fullFileName); + string fileExtension = Path.GetExtension(fullFileName); string fName = userIdentityName + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); physicalPath = Path.Combine(lotTempPipeLine, fName + "." + fileExtension); @@ -142,20 +142,18 @@ public class LotDispositionHelper { stream.CopyTo(fileStream); } -#if !NET8 - ExcelData x = new ExcelData(physicalPath); - var lotNumbers = x.ReadData(); + ExcelData x = new (physicalPath); + IEnumerable lotNumbers = x.ReadData(); - foreach (var lotInfo in lotNumbers) { - Lot l = new Lot(); - l.LotNumber = lotInfo.LotNo; + foreach (ExcelData.ExcelLotInfo lotInfo in lotNumbers) { + Lot l = new(); + l.LotNumber = lotInfo.LotNo ?? string.Empty; l.IssueID = issueID; if (l.LotStatusOptionID == 0) l.LotStatusOption.LotStatusOptionID = (int)GlobalVars.LotStatusOption.Release; lotDispositionDMO.InsertLot(l, true); } -#endif FileInfo f = new(physicalPath); if (f.Exists) diff --git a/Fab2ApprovalSystem/Misc/MRBHelper.cs b/Fab2ApprovalSystem/Misc/MRBHelper.cs index abcb1a6..103b596 100644 --- a/Fab2ApprovalSystem/Misc/MRBHelper.cs +++ b/Fab2ApprovalSystem/Misc/MRBHelper.cs @@ -46,14 +46,12 @@ public class MRBHelper { stream.CopyTo(fileStream); } -#if !NET8 - ExcelData x = new ExcelData(physicalPath); + ExcelData x = new(physicalPath); lotDataList = x.ReadQDBFlagData(); foreach (string lotData in lotDataList) { mrbDMO.InsertMRB_QDB_HoldFlag(guid, lotData, operation); } -#endif FileInfo f = new(physicalPath); if (f.Exists) @@ -170,14 +168,12 @@ public class MRBHelper { stream.CopyTo(fileStream); } -#if !NET8 - ExcelData x = new ExcelData(physicalPath); + ExcelData x = new(physicalPath); lotDataList = x.ReadQDBFlagData(); foreach (string lotData in lotDataList) { mrbDMO.InsertMRB_QDB_HoldFlag(guid, lotData, operation); } -#endif FileInfo f = new(physicalPath); if (f.Exists) @@ -246,17 +242,16 @@ public class MRBHelper { string fName = userIdentityName + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); string physicalPath = Path.Combine(lotTempPipeLine, fName + "." + fileExtension); -#if !NET8 IEnumerable lotNumbers; try { - using (var fileStream = new FileStream(physicalPath, FileMode.Create, FileAccess.Write)) { + using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) { stream.CopyTo(fileStream); } - ExcelData x = new ExcelData(physicalPath); + ExcelData x = new(physicalPath); lotNumbers = x.ReadData(); } catch (Exception ex) { - throw new Exception(String.Format("Invalid file format for {0}: {1}", fileName, ex.Message)); + throw new Exception(string.Format("Invalid file format for {0}: {1}", fileName, ex.Message)); } // Get Tool, Issue Start and End Date @@ -266,7 +261,7 @@ public class MRBHelper { foreach (var lotInfo in lotNumbers) { if (lotInfo.LotDispo.Length == 1) { if (dispos.Count(d => d.DispositionType.Trim().ToUpper() == lotInfo.LotDispo.Trim().ToUpper()) == 0) { - throw new Exception(String.Format("Invalid lot disposition {0} for lot no {1}", + throw new Exception(string.Format("Invalid lot disposition {0} for lot no {1}", lotInfo.LotDispo, lotInfo.LotNo)); } } @@ -276,8 +271,8 @@ public class MRBHelper { if (!mrbInfo.ToolCSV.ToUpper().Equals("NA")) { foreach (var lotInfo in lotNumbers) { bool existingLotUpdated; - Lot l = new Lot(); - l.LotNumber = lotInfo.LotNo; + Lot l = new(); + l.LotNumber = lotInfo.LotNo ?? string.Empty; if (lotInfo.LotDispo.Length == 1) { l.DispoType = lotInfo.LotDispo[0]; } @@ -298,8 +293,8 @@ public class MRBHelper { // Only find the child Splits when a Tool or a list of Tools is provided foreach (var lotInfo in lotNumbers) { bool existingLotUpdated; - Lot l = new Lot(); - l.LotNumber = lotInfo.LotNo; + Lot l = new(); + l.LotNumber = lotInfo.LotNo ?? string.Empty; if (lotInfo.LotDispo.Length == 1) { l.DispoType = lotInfo.LotDispo[0]; } @@ -308,7 +303,6 @@ public class MRBHelper { mrbDMO.InsertLot(l, true, out existingLotUpdated); } } -#endif FileInfo f = new(physicalPath); if (f.Exists) diff --git a/Fab2ApprovalSystem/Views/ECN/Acknowledge.cshtml b/Fab2ApprovalSystem/Views/ECN/Acknowledge.cshtml index 1f6afa6..19e35dc 100644 --- a/Fab2ApprovalSystem/Views/ECN/Acknowledge.cshtml +++ b/Fab2ApprovalSystem/Views/ECN/Acknowledge.cshtml @@ -210,10 +210,10 @@ @Html.TextBoxFor(model => model.Title, new { id = "txtTitle", @class = "k-textbox", style = "width:100%", disabled = "disabled" })
- *(DO NOT USE Rev I, O, Q, S, X, and Z) + * (DO NOT USE Rev I, O, S, X, and Z)
- Revision Y is followed by AA. YY is followed by AAA + Revision Y is followed by AA-AY, AY is followed by BA-BY etc. YY is followed by AAA
diff --git a/Fab2ApprovalSystem/Views/ECN/Edit.cshtml b/Fab2ApprovalSystem/Views/ECN/Edit.cshtml index eccb0e6..75db90d 100644 --- a/Fab2ApprovalSystem/Views/ECN/Edit.cshtml +++ b/Fab2ApprovalSystem/Views/ECN/Edit.cshtml @@ -154,10 +154,10 @@ @Html.TextBoxFor(model => model.Title, new { id = "txtTitle", @class = "k-textbox", style = "width:100%" })
- *(DO NOT USE Rev I, O, Q, S, X, and Z) + * (DO NOT USE Rev I, O, S, X, and Z)
- Revision Y is followed by AA. YY is followed by AAA + Revision Y is followed by AA-AY, AY is followed by BA-BY etc. YY is followed by AAA
diff --git a/Fab2ApprovalSystem/Views/ECN/EditApproval.cshtml b/Fab2ApprovalSystem/Views/ECN/EditApproval.cshtml index d72fd88..59f70aa 100644 --- a/Fab2ApprovalSystem/Views/ECN/EditApproval.cshtml +++ b/Fab2ApprovalSystem/Views/ECN/EditApproval.cshtml @@ -260,10 +260,10 @@ @Html.TextBoxFor(model => model.Title, new { id = "txtTitle", @class = "k-textbox", style = "width:100%", disabled = "disabled" })
- *(DO NOT USE Rev I, O, Q, S, X, and Z) + * (DO NOT USE Rev I, O, S, X, and Z)
- Revision Y is followed by AA. YY is followed by AAA + Revision Y is followed by AA-AY, AY is followed by BA-BY etc. YY is followed by AAA
diff --git a/Fab2ApprovalSystem/pipelines-manual.yml b/Fab2ApprovalSystem/pipelines-manual.yml new file mode 100644 index 0000000..f6456e8 --- /dev/null +++ b/Fab2ApprovalSystem/pipelines-manual.yml @@ -0,0 +1,224 @@ +variables: + coreVersion: "net8.0" + targetFrameworkVersion: "v4.8" + nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/" + msBuild: "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" + +stages: + - stage: Development + displayName: Development + pool: + name: MesaFabApproval + demands: Fab2ApprovalSystem-Dev + variables: + ASPNETCORE_ENVIRONMENT: "Development" + assemblyTitle: "Fab2ApprovalSystem" + configuration: "Debug" + jobs: + - job: DebugDotnet + steps: + - script: | + echo BuildId: $(Build.BuildId) + echo Build reason: $(Build.Reason) + echo Repo Id: $(Build.Repository.Id) + echo Repo name: $(Build.Repository.Name) + echo Source version: $(Build.SourceVersion) + echo Core version: $(CoreVersion) + echo Configuration: $(Configuration) + echo Target Framework version: $(TargetFrameworkVersion) + echo Assembly title: $(AssemblyTitle) + echo MicrosoftBuildEngine: $(msBuild) + echo NugetSource: $(NugetSource) + displayName: "Echo Check" + + - script: | + mklink /J ".vscode\.UserSecrets" "%AppData%\Microsoft\UserSecrets\f2da5035-aba9-4676-9f8d-d6689f84663d" + mklink /J "DMO" "..\Fab2ApprovalSystem\DMO" + mklink /J "Jobs" "..\Fab2ApprovalSystem\Jobs" + mklink /J "JobSchedules" "..\Fab2ApprovalSystem\JobSchedules" + mklink /J "Misc" "..\Fab2ApprovalSystem\Misc" + mklink /J "Models" "..\Fab2ApprovalSystem\Models" + mklink /J "PdfGenerator" "..\Fab2ApprovalSystem\PdfGenerator" + mklink /J "Utilities" "..\Fab2ApprovalSystem\Utilities" + mklink /J "ViewModels" "..\Fab2ApprovalSystem\ViewModels" + workingDirectory: Fab2ApprovalMKLink + displayName: "MKLink - Symbolic Link of Type Junction" + + - script: | + dotnet user-secrets init + dotnet user-secrets set BuildNumber $(Build.BuildId) + dotnet user-secrets set "GitCommit" "$(Build.SourceVersion)" + dotnet user-secrets list + workingDirectory: Fab2ApprovalMKLink + displayName: "MKLink - Safe storage of app secrets" + + - script: dotnet build --configuration $(Configuration) --source $(NugetSource) + workingDirectory: Fab2ApprovalMKLink + displayName: "MKLink - Build" + + - script: dotnet build --configuration $(Configuration) --source $(NugetSource) + workingDirectory: Fab2ApprovalTests + displayName: "Tests - Build" + + - script: dotnet test --configuration $(Configuration) + workingDirectory: Fab2ApprovalTests + displayName: "Tests - Test" + + - script: dotnet clean --configuration $(Configuration) + workingDirectory: Fab2ApprovalTests + displayName: "Tests - Clean" + + - script: dotnet clean --configuration $(Configuration) + workingDirectory: Fab2ApprovalMKLink + displayName: "MKLink - Clean" + + - job: DebugMicrosoftBuildEngine + steps: + - script: | + echo BuildId: $(Build.BuildId) + echo Build reason: $(Build.Reason) + echo Repo Id: $(Build.Repository.Id) + echo Repo name: $(Build.Repository.Name) + echo Source version: $(Build.SourceVersion) + echo Core version: $(CoreVersion) + echo Configuration: $(Configuration) + echo Target Framework version: $(TargetFrameworkVersion) + echo Assembly title: $(AssemblyTitle) + echo MicrosoftBuildEngine: $(msBuild) + echo NugetSource: $(NugetSource) + displayName: "Echo Check" + + - script: '"$(msBuild)" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:RestoreSources=$(NugetSource) $(AssemblyTitle).csproj' + workingDirectory: Fab2ApprovalSystem + displayName: "Framework - Restore" + + - script: '"$(msBuild)" /target:Build /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj' + workingDirectory: Fab2ApprovalSystem + displayName: "Framework - Build" + + - script: '"$(msBuild)" /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:DebugSymbols=false /p:DeleteExistingFiles=true /p:DeployOnBuild=true /p:EnableUpdateAble=true /p:ExcludeApp_Data=true /p:LastUsedconfiguration=$(Configuration) /p:LastUsedPlatform="Any CPU" /p:LaunchSiteAfterPublish=true /p:OutputPath=bin/$(Configuration) /p:PreCompileBeforePublish=true /p:PublishProvider=FileSystem /p:PublishUrl="D:/PublishUrl" /p:SiteUrlToLaunchAfterPublish="" /p:WDPMergeOption=DoNotMerge /p:WebPublishMethod=FileSystem $(AssemblyTitle).csproj' + workingDirectory: Fab2ApprovalSystem + displayName: "Framework - Package (.zip for msdeploy.exe)" + + - task: CopyFiles@2 + displayName: 'Copy Files to: D:\' + inputs: + Contents: "*" + SourceFolder: '$(AssemblyTitle)\bin\$(Configuration)\_PublishedWebsites\$(AssemblyTitle)_Package' + TargetFolder: 'D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(Build.BuildId)\$(Configuration)-$(AssemblyTitle)-Package' + OverWrite: true + + - script: '"$(msBuild)" /target:Clean /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj' + workingDirectory: Fab2ApprovalSystem + displayName: "Framework - Clean" + + - stage: Release + displayName: Release + pool: + name: MesaFabApproval + demands: Fab2ApprovalSystem + variables: + ASPNETCORE_ENVIRONMENT: "Production" + assemblyTitle: "Fab2ApprovalSystem" + configuration: "Release" + jobs: + - job: ReleaseDotnet + steps: + - script: | + echo BuildId: $(Build.BuildId) + echo Build reason: $(Build.Reason) + echo Repo Id: $(Build.Repository.Id) + echo Repo name: $(Build.Repository.Name) + echo Source version: $(Build.SourceVersion) + echo Core version: $(CoreVersion) + echo Configuration: $(Configuration) + echo Target Framework version: $(TargetFrameworkVersion) + echo Assembly title: $(AssemblyTitle) + echo MicrosoftBuildEngine: $(msBuild) + echo NugetSource: $(NugetSource) + displayName: "Echo Check" + + - script: | + mklink /J ".vscode\.UserSecrets" "%AppData%\Microsoft\UserSecrets\f2da5035-aba9-4676-9f8d-d6689f84663d" + mklink /J "DMO" "..\Fab2ApprovalSystem\DMO" + mklink /J "Jobs" "..\Fab2ApprovalSystem\Jobs" + mklink /J "JobSchedules" "..\Fab2ApprovalSystem\JobSchedules" + mklink /J "Misc" "..\Fab2ApprovalSystem\Misc" + mklink /J "Models" "..\Fab2ApprovalSystem\Models" + mklink /J "PdfGenerator" "..\Fab2ApprovalSystem\PdfGenerator" + mklink /J "Utilities" "..\Fab2ApprovalSystem\Utilities" + mklink /J "ViewModels" "..\Fab2ApprovalSystem\ViewModels" + workingDirectory: Fab2ApprovalMKLink + displayName: "MKLink - Symbolic Link of Type Junction" + + - script: | + dotnet user-secrets init + dotnet user-secrets set BuildNumber $(Build.BuildId) + dotnet user-secrets set "GitCommit" "$(Build.SourceVersion)" + dotnet user-secrets list + workingDirectory: Fab2ApprovalMKLink + displayName: "MKLink - Safe storage of app secrets" + + - script: dotnet build --configuration $(Configuration) --source $(NugetSource) + workingDirectory: Fab2ApprovalMKLink + displayName: "MKLink - Build" + + - script: dotnet build --configuration $(Configuration) --source $(NugetSource) + workingDirectory: Fab2ApprovalTests + displayName: "Tests - Build" + + - script: dotnet test --configuration $(Configuration) + workingDirectory: Fab2ApprovalTests + displayName: "Tests - Test" + + - script: dotnet clean --configuration $(Configuration) + workingDirectory: Fab2ApprovalTests + displayName: "Tests - Clean" + + - script: dotnet clean --configuration $(Configuration) + workingDirectory: Fab2ApprovalMKLink + displayName: "MKLink - Clean" + + - job: ReleaseMicrosoftBuildEngine + steps: + - script: | + echo BuildId: $(Build.BuildId) + echo Build reason: $(Build.Reason) + echo Repo Id: $(Build.Repository.Id) + echo Repo name: $(Build.Repository.Name) + echo Source version: $(Build.SourceVersion) + echo Core version: $(CoreVersion) + echo Configuration: $(Configuration) + echo Target Framework version: $(TargetFrameworkVersion) + echo Assembly title: $(AssemblyTitle) + echo MicrosoftBuildEngine: $(msBuild) + echo NugetSource: $(NugetSource) + displayName: "Echo Check" + + - script: '"$(msBuild)" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:RestoreSources=$(NugetSource) $(AssemblyTitle).csproj' + workingDirectory: Fab2ApprovalSystem + displayName: "Framework - Restore" + + - script: '"$(msBuild)" /target:Build /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj' + workingDirectory: Fab2ApprovalSystem + displayName: "Framework - Build" + + - script: '"$(msBuild)" /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:DebugSymbols=false /p:DeleteExistingFiles=true /p:DeployOnBuild=true /p:EnableUpdateAble=true /p:ExcludeApp_Data=true /p:LastUsedconfiguration=$(Configuration) /p:LastUsedPlatform="Any CPU" /p:LaunchSiteAfterPublish=true /p:OutputPath=bin/$(Configuration) /p:PreCompileBeforePublish=true /p:PublishProvider=FileSystem /p:PublishUrl="D:/PublishUrl" /p:SiteUrlToLaunchAfterPublish="" /p:WDPMergeOption=DoNotMerge /p:WebPublishMethod=FileSystem $(AssemblyTitle).csproj' + workingDirectory: Fab2ApprovalSystem + displayName: "Framework - Package (.zip for msdeploy.exe)" + + - task: CopyFiles@2 + displayName: 'Copy Files to: D:\' + inputs: + Contents: "*" + SourceFolder: '$(AssemblyTitle)\bin\$(Configuration)\_PublishedWebsites\$(AssemblyTitle)_Package' + TargetFolder: 'D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(Build.BuildId)\$(Configuration)-$(AssemblyTitle)-Package' + OverWrite: true + + - script: '"$(msBuild)" /target:Clean /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj' + workingDirectory: Fab2ApprovalSystem + displayName: "Framework - Clean" + + - script: 'echo $(Build.BuildId)-$(Build.SourceVersion)-bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' + displayName: "Force Fail" + enabled: true