Skip to content

Commit

Permalink
Serve Embedded resource : Support of space in Assembly name by replac…
Browse files Browse the repository at this point in the history
…ing space to "_". (#50)

When creating a project in visual studio with space in its name, the assembly name corresponds to the project name but the Default Namespace is transform to safe project name by replacing space to "_". To access embedded resource using the assembly name, this default namespace must correspond to the assembly name. This correction prevents difficult and time-consuming resolution.
  • Loading branch information
P-H-Maillefer authored Sep 9, 2020
1 parent 7e651aa commit 8ac96b6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ private bool ServeEmbeddedResource(HTTPResponse response, Assembly assembly,

private string FullResourceName(Assembly assembly, string strippedResourceName)
{
return string.Format("{0}.{1}", assembly.GetName().Name, strippedResourceName);
string safeDefaultNamesapceFromAssemblyName = assembly.GetName().Name.Replace(" ", "_");
return string.Format("{0}.{1}", safeDefaultNamesapceFromAssemblyName, strippedResourceName);
}

private Assembly AssemblyByName(string name)
Expand Down

0 comments on commit 8ac96b6

Please sign in to comment.