Skip to content

Commit

Permalink
Merge pull request #8 from odair-pedro/bugfix/embedded-resource
Browse files Browse the repository at this point in the history
Included an adjust for embedded resource path on csproj
  • Loading branch information
odair-pedro committed Jun 3, 2020
2 parents 0d217d0 + 26697b3 commit 7f344d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Evolve.Migrations.Helper.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Evolve.Migrations.Helper", "Evolve.Migrations.Helper\Evolve.Migrations.Helper.csproj", "{2F6073C3-6FFB-4B5C-9D5E-DA222FE5C914}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Evolve.Migrations.Helper.Tests", "Evolve.Migrations.Helper.Tests\Evolve.Migrations.Helper.Tests.csproj", "{DFF67BB6-1070-4BA9-B76E-67EC990379F6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -12,5 +14,9 @@ Global
{2F6073C3-6FFB-4B5C-9D5E-DA222FE5C914}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F6073C3-6FFB-4B5C-9D5E-DA222FE5C914}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F6073C3-6FFB-4B5C-9D5E-DA222FE5C914}.Release|Any CPU.Build.0 = Release|Any CPU
{DFF67BB6-1070-4BA9-B76E-67EC990379F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DFF67BB6-1070-4BA9-B76E-67EC990379F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DFF67BB6-1070-4BA9-B76E-67EC990379F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DFF67BB6-1070-4BA9-B76E-67EC990379F6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
7 changes: 6 additions & 1 deletion Evolve.Migrations.Helper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,17 @@ private static void ChangeCsProjFile(string rootPath, string filePath)
var nodeItens = nodeProject.SelectNodes("//ItemGroup");
var nodeItem = nodeItens[^1];
var nodeNone = xml.CreateElement("EmbeddedResource");
nodeNone.SetAttribute("Update", Path.Combine(rootPath, Path.GetFileName(filePath)));
nodeNone.SetAttribute("Include", AdjustPathToIncludeOnCsProj(rootPath, filePath));
var nodeCopy = xml.CreateElement("CopyToOutputDirectory");
nodeCopy.InnerText = "Always";
nodeNone.AppendChild(nodeCopy);
nodeItem.AppendChild(nodeNone);
xml.Save(projFile);
}

private static string AdjustPathToIncludeOnCsProj(string rootPath, string filePath)
{
return $"{rootPath.Replace('/', '\\')}\\{Path.GetFileName(filePath)}";
}
}
}

0 comments on commit 7f344d2

Please sign in to comment.