GetManifestResourceNames: Some resources are not embedded (Not authorized?)
When the embedded resource is named with this kind pattern:
whatever.xxx.whatever
Replace xxx with one of the following examples: agq,arn,asa,ast,bas,bem,bez,bin. Assembly.GetManifestResourceNames won't find them. There are about a hundred of them. (Check the code below to find them all)
I keep getting the same results be it with .Net framework or .Net core.
Is this kind of naming unauthorized because it looks like some sort of forbidden extension file name? If so, how to disable this dumb security rule.
List<string> codes = new List<string>();
for (char first = 'a'; first <= (int)'z'; first++)
for (char second = 'a'; second <= (int)'z'; second++)
for (char third = 'a'; third <= (int)'z'; third++)
codes.Add(first.ToString() + second + third);
codes = codes.Take(1000).ToList();
string slnPath = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName;
while (!Directory.GetFiles(slnPath).Any(x => x.EndsWith(".sln")))
slnPath = Directory.GetParent(slnPath).FullName;
string classLibraryFolder = "ClassLibrary1";
var csjFolder = Path.Combine(slnPath, classLibraryFolder);
var csjPath = Path.Combine(csjFolder, $"classLibraryFolder.csproj");
string resourcesFolder = "Resources";
string resourcesPath = Path.Combine(csjFolder, resourcesFolder);
XDocument doc = XDocument.Load(csjPath);
if(!doc.Descendants().Attributes().Any(x=> x.Value == $"resourcesFolder\x.aaa.x"))
Console.WriteLine("Creating embedded resources...");
Directory.CreateDirectory(resourcesPath);
foreach (var code in codes)
File.Create(Path.Combine(resourcesPath, "x." + code + ".x")).Close();
Console.WriteLine("Updating csproj...");
var xNone = new XElement("ItemGroup");
foreach (var code in codes)
xNone.Add(new XElement("None", new XAttribute("Remove", $"resourcesFolder\x.code.x")));
var xEmbeddedResource = new XElement("ItemGroup");
foreach (var code in codes)
xEmbeddedResource.Add(new XElement("EmbeddedResource", new XAttribute("Include", $"resourcesFolder\x.code.x")));
doc.Root.Add(xNone);
doc.Root.Add(xEmbeddedResource);
doc.Save(csjPath);
Console.WriteLine("Please relaunch program.");
return;
string Languages2 = typeof(ClassLibrary1.Class1).GetTypeInfo().Assembly.GetManifestResourceNames().ToArray();
var present = codes.Where(code => Languages2.Any(x => x.EndsWith($"x.code.x"))).ToList();
var missing = codes.Except(present).ToList();
.net embedded-resource
add a comment |
When the embedded resource is named with this kind pattern:
whatever.xxx.whatever
Replace xxx with one of the following examples: agq,arn,asa,ast,bas,bem,bez,bin. Assembly.GetManifestResourceNames won't find them. There are about a hundred of them. (Check the code below to find them all)
I keep getting the same results be it with .Net framework or .Net core.
Is this kind of naming unauthorized because it looks like some sort of forbidden extension file name? If so, how to disable this dumb security rule.
List<string> codes = new List<string>();
for (char first = 'a'; first <= (int)'z'; first++)
for (char second = 'a'; second <= (int)'z'; second++)
for (char third = 'a'; third <= (int)'z'; third++)
codes.Add(first.ToString() + second + third);
codes = codes.Take(1000).ToList();
string slnPath = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName;
while (!Directory.GetFiles(slnPath).Any(x => x.EndsWith(".sln")))
slnPath = Directory.GetParent(slnPath).FullName;
string classLibraryFolder = "ClassLibrary1";
var csjFolder = Path.Combine(slnPath, classLibraryFolder);
var csjPath = Path.Combine(csjFolder, $"classLibraryFolder.csproj");
string resourcesFolder = "Resources";
string resourcesPath = Path.Combine(csjFolder, resourcesFolder);
XDocument doc = XDocument.Load(csjPath);
if(!doc.Descendants().Attributes().Any(x=> x.Value == $"resourcesFolder\x.aaa.x"))
Console.WriteLine("Creating embedded resources...");
Directory.CreateDirectory(resourcesPath);
foreach (var code in codes)
File.Create(Path.Combine(resourcesPath, "x." + code + ".x")).Close();
Console.WriteLine("Updating csproj...");
var xNone = new XElement("ItemGroup");
foreach (var code in codes)
xNone.Add(new XElement("None", new XAttribute("Remove", $"resourcesFolder\x.code.x")));
var xEmbeddedResource = new XElement("ItemGroup");
foreach (var code in codes)
xEmbeddedResource.Add(new XElement("EmbeddedResource", new XAttribute("Include", $"resourcesFolder\x.code.x")));
doc.Root.Add(xNone);
doc.Root.Add(xEmbeddedResource);
doc.Save(csjPath);
Console.WriteLine("Please relaunch program.");
return;
string Languages2 = typeof(ClassLibrary1.Class1).GetTypeInfo().Assembly.GetManifestResourceNames().ToArray();
var present = codes.Where(code => Languages2.Any(x => x.EndsWith($"x.code.x"))).ToList();
var missing = codes.Except(present).ToList();
.net embedded-resource
1
Brr, fighting the .csproj file wasn't a lot of fun. You'll find the missing resources in their own satellite assembly instead of getting embedded in the dll. This decision is made by the msbuild AssignCulture task. Why it thinks that "bin", "bez", etc are valid culture identifiers is not obvious to me. You'll want a different naming convention to avoid this.
– Hans Passant
Nov 12 '18 at 9:26
Compare to this list.
– Hans Passant
Nov 12 '18 at 9:51
add a comment |
When the embedded resource is named with this kind pattern:
whatever.xxx.whatever
Replace xxx with one of the following examples: agq,arn,asa,ast,bas,bem,bez,bin. Assembly.GetManifestResourceNames won't find them. There are about a hundred of them. (Check the code below to find them all)
I keep getting the same results be it with .Net framework or .Net core.
Is this kind of naming unauthorized because it looks like some sort of forbidden extension file name? If so, how to disable this dumb security rule.
List<string> codes = new List<string>();
for (char first = 'a'; first <= (int)'z'; first++)
for (char second = 'a'; second <= (int)'z'; second++)
for (char third = 'a'; third <= (int)'z'; third++)
codes.Add(first.ToString() + second + third);
codes = codes.Take(1000).ToList();
string slnPath = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName;
while (!Directory.GetFiles(slnPath).Any(x => x.EndsWith(".sln")))
slnPath = Directory.GetParent(slnPath).FullName;
string classLibraryFolder = "ClassLibrary1";
var csjFolder = Path.Combine(slnPath, classLibraryFolder);
var csjPath = Path.Combine(csjFolder, $"classLibraryFolder.csproj");
string resourcesFolder = "Resources";
string resourcesPath = Path.Combine(csjFolder, resourcesFolder);
XDocument doc = XDocument.Load(csjPath);
if(!doc.Descendants().Attributes().Any(x=> x.Value == $"resourcesFolder\x.aaa.x"))
Console.WriteLine("Creating embedded resources...");
Directory.CreateDirectory(resourcesPath);
foreach (var code in codes)
File.Create(Path.Combine(resourcesPath, "x." + code + ".x")).Close();
Console.WriteLine("Updating csproj...");
var xNone = new XElement("ItemGroup");
foreach (var code in codes)
xNone.Add(new XElement("None", new XAttribute("Remove", $"resourcesFolder\x.code.x")));
var xEmbeddedResource = new XElement("ItemGroup");
foreach (var code in codes)
xEmbeddedResource.Add(new XElement("EmbeddedResource", new XAttribute("Include", $"resourcesFolder\x.code.x")));
doc.Root.Add(xNone);
doc.Root.Add(xEmbeddedResource);
doc.Save(csjPath);
Console.WriteLine("Please relaunch program.");
return;
string Languages2 = typeof(ClassLibrary1.Class1).GetTypeInfo().Assembly.GetManifestResourceNames().ToArray();
var present = codes.Where(code => Languages2.Any(x => x.EndsWith($"x.code.x"))).ToList();
var missing = codes.Except(present).ToList();
.net embedded-resource
When the embedded resource is named with this kind pattern:
whatever.xxx.whatever
Replace xxx with one of the following examples: agq,arn,asa,ast,bas,bem,bez,bin. Assembly.GetManifestResourceNames won't find them. There are about a hundred of them. (Check the code below to find them all)
I keep getting the same results be it with .Net framework or .Net core.
Is this kind of naming unauthorized because it looks like some sort of forbidden extension file name? If so, how to disable this dumb security rule.
List<string> codes = new List<string>();
for (char first = 'a'; first <= (int)'z'; first++)
for (char second = 'a'; second <= (int)'z'; second++)
for (char third = 'a'; third <= (int)'z'; third++)
codes.Add(first.ToString() + second + third);
codes = codes.Take(1000).ToList();
string slnPath = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName;
while (!Directory.GetFiles(slnPath).Any(x => x.EndsWith(".sln")))
slnPath = Directory.GetParent(slnPath).FullName;
string classLibraryFolder = "ClassLibrary1";
var csjFolder = Path.Combine(slnPath, classLibraryFolder);
var csjPath = Path.Combine(csjFolder, $"classLibraryFolder.csproj");
string resourcesFolder = "Resources";
string resourcesPath = Path.Combine(csjFolder, resourcesFolder);
XDocument doc = XDocument.Load(csjPath);
if(!doc.Descendants().Attributes().Any(x=> x.Value == $"resourcesFolder\x.aaa.x"))
Console.WriteLine("Creating embedded resources...");
Directory.CreateDirectory(resourcesPath);
foreach (var code in codes)
File.Create(Path.Combine(resourcesPath, "x." + code + ".x")).Close();
Console.WriteLine("Updating csproj...");
var xNone = new XElement("ItemGroup");
foreach (var code in codes)
xNone.Add(new XElement("None", new XAttribute("Remove", $"resourcesFolder\x.code.x")));
var xEmbeddedResource = new XElement("ItemGroup");
foreach (var code in codes)
xEmbeddedResource.Add(new XElement("EmbeddedResource", new XAttribute("Include", $"resourcesFolder\x.code.x")));
doc.Root.Add(xNone);
doc.Root.Add(xEmbeddedResource);
doc.Save(csjPath);
Console.WriteLine("Please relaunch program.");
return;
string Languages2 = typeof(ClassLibrary1.Class1).GetTypeInfo().Assembly.GetManifestResourceNames().ToArray();
var present = codes.Where(code => Languages2.Any(x => x.EndsWith($"x.code.x"))).ToList();
var missing = codes.Except(present).ToList();
.net embedded-resource
.net embedded-resource
asked Nov 11 '18 at 21:06
AkliAkli
702820
702820
1
Brr, fighting the .csproj file wasn't a lot of fun. You'll find the missing resources in their own satellite assembly instead of getting embedded in the dll. This decision is made by the msbuild AssignCulture task. Why it thinks that "bin", "bez", etc are valid culture identifiers is not obvious to me. You'll want a different naming convention to avoid this.
– Hans Passant
Nov 12 '18 at 9:26
Compare to this list.
– Hans Passant
Nov 12 '18 at 9:51
add a comment |
1
Brr, fighting the .csproj file wasn't a lot of fun. You'll find the missing resources in their own satellite assembly instead of getting embedded in the dll. This decision is made by the msbuild AssignCulture task. Why it thinks that "bin", "bez", etc are valid culture identifiers is not obvious to me. You'll want a different naming convention to avoid this.
– Hans Passant
Nov 12 '18 at 9:26
Compare to this list.
– Hans Passant
Nov 12 '18 at 9:51
1
1
Brr, fighting the .csproj file wasn't a lot of fun. You'll find the missing resources in their own satellite assembly instead of getting embedded in the dll. This decision is made by the msbuild AssignCulture task. Why it thinks that "bin", "bez", etc are valid culture identifiers is not obvious to me. You'll want a different naming convention to avoid this.
– Hans Passant
Nov 12 '18 at 9:26
Brr, fighting the .csproj file wasn't a lot of fun. You'll find the missing resources in their own satellite assembly instead of getting embedded in the dll. This decision is made by the msbuild AssignCulture task. Why it thinks that "bin", "bez", etc are valid culture identifiers is not obvious to me. You'll want a different naming convention to avoid this.
– Hans Passant
Nov 12 '18 at 9:26
Compare to this list.
– Hans Passant
Nov 12 '18 at 9:51
Compare to this list.
– Hans Passant
Nov 12 '18 at 9:51
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253241%2fgetmanifestresourcenames-some-resources-are-not-embedded-not-authorized%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253241%2fgetmanifestresourcenames-some-resources-are-not-embedded-not-authorized%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Brr, fighting the .csproj file wasn't a lot of fun. You'll find the missing resources in their own satellite assembly instead of getting embedded in the dll. This decision is made by the msbuild AssignCulture task. Why it thinks that "bin", "bez", etc are valid culture identifiers is not obvious to me. You'll want a different naming convention to avoid this.
– Hans Passant
Nov 12 '18 at 9:26
Compare to this list.
– Hans Passant
Nov 12 '18 at 9:51