Skip to content

Commit

Permalink
Fixes and updates for Runtime and SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
jhannahLCD committed Mar 17, 2021
1 parent 500d217 commit c4c2ae5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public async Task MigrateAspxFiles(IReadOnlyList<VsModel> webFormProjectData, Vs
//Informing the dialog the migration step has started.
await _statusTracking.UpdateStepStatusAsync(MigrationStepEnum.AspxPages, MigrationStatusEnum.Running);

//Getting all the aspx files in the project.
var aspxFiles = webFormProjectData.Where(p => p.ModelType == VisualStudioModelType.Document && p.Name.EndsWith(".aspx")).Cast<VsDocument>();
//Getting all the aspx & ascx files in the project.
var aspxFiles = webFormProjectData.Where(p => p.ModelType == VisualStudioModelType.Document && ( p.Name.EndsWith(".aspx") || p.Name.EndsWith(".ascx"))).Cast<VsDocument>();

if (!aspxFiles.Any())
{
Expand Down Expand Up @@ -85,6 +85,7 @@ await _statusTracking.UpdateStepStatusAsync(MigrationStepEnum.AspxPages,
//Getting the formatted names that will be used in migrating the ASPX file and its code behind to the blazor project.
string targetFileNameNoExtension = Path.GetFileNameWithoutExtension(aspxFile.Path);
string aspxCodeBehindFileName = $"{targetFileNameNoExtension}.aspx.cs";
string ascxCodeBehindFileName = $"{targetFileNameNoExtension}.axcs.cs";
string razorPageFileName = $"{targetFileNameNoExtension}.razor";
string razorPageCodeBehindFileName = $"{targetFileNameNoExtension}.razor.cs";

Expand Down Expand Up @@ -135,13 +136,22 @@ await _statusTracking.UpdateCurrentStatusAsync(MigrationStepEnum.AspxPages,
}
}

VsCSharpSource CodeBehindSource = null;
if (aspxFile.Path.Contains("ascx"))
{
//Getting the code behind file that supports the current aspx page.
CodeBehindSource = webFormProjectData
.Where(m => m.ModelType == VisualStudioModelType.CSharpSource).Cast<VsCSharpSource>()
.FirstOrDefault(s => s.SourceCode.SourceDocument.ToLower().EndsWith(ascxCodeBehindFileName.ToLower())) as VsCSharpSource;
}

//Getting the code behind file that supports the current aspx page.
var aspxCodeBehindSource = webFormProjectData
CodeBehindSource = webFormProjectData
.Where(m => m.ModelType == VisualStudioModelType.CSharpSource).Cast<VsCSharpSource>()
.FirstOrDefault(s => s.SourceCode.SourceDocument.ToLower().EndsWith(aspxCodeBehindFileName.ToLower())) as VsCSharpSource;

//Converting the aspx page and the code behind file if it was found.
await ConvertAspxPage(aspxFile, blazorServerProject, blazorPagesFolder, aspxCodeBehindSource);
await ConvertAspxPage(aspxFile, blazorServerProject, blazorPagesFolder, CodeBehindSource);

if (collect == 4)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CodeFactory.Formatting.CSharp">
<Version>0.90.202401</Version>
<Version>1.21068.1</Version>
</PackageReference>
<PackageReference Include="CodeFactory.Markup.Adapter">
<Version>1.0.20288</Version>
</PackageReference>
<PackageReference Include="HtmlAgilityPack">
<Version>1.11.24</Version>
<Version>1.11.31</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
Expand All @@ -53,7 +53,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<PackageReference Include="CodeFactorySDK">
<Version>1.0.202301</Version>
<Version>1.21068.1</Version>
</PackageReference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand Down

0 comments on commit c4c2ae5

Please sign in to comment.