How to fix EmbeddedRessources on an ASP.NET website?

I try to reference a js file in a class in ASP.NET and I get this error:

The assembly "XXX" contains a web resource named "XXX" but does not contain an embedded resource named "XXX"

An Internet search tells me that I should have a problem with a link to Path, but I can’t understand what it is.

Here is the hierarchy

<Root>
   <App_Code>
      <Application>
          <MyClass.cs NameSpace="None" />
      </Application>
   </App_Code>
   <JS>
      <MyJSFile.js NameSpace="MyControls" Name="MyJSFile">
   </JS>
</Root>

So in MyClass.cs I have:

[assembly: WebResource("MyControls.JS.MyJSFile.js", "text/javascript")]

[ClientScriptResource("MyControls.JS.MyJSFile", "MyControls.JS.MyJSFile.js")]
public class MyClass : ExtenderControlBase
{}

So, I think I did not get the link: (RootNampeSpace). (Way). (FileName). (Expansion)

My project is an ASP.NET website, so I have no properties for the Build action for embedded resources.

Also in the App_Code folder, I get an error if I put my JS file saying that the language does not match the other file in App_Code.

+3
2

, , , , , . , - ...

, , -.

+1

- - ASP.NET, Build Action Embedded Resources.

, , , . , ?

0

Source: https://habr.com/ru/post/1703311/


All Articles