I'm trying to prevent Visual Studio from trying to validate my relative image URIs for a WebForms project, but I can't find a way to do it. So far, I can't find any kind of war开发者_JS百科ning ID or category. The images can't be resolved because they are not 'included' in my project, even though they do exist in the file structure.
This is a large application, so I hesitate to just include thousands of images in my project when I would rather just suppress the warnings.
Any thoughts?
Try adding "~" to the URLs along with the runat="server" attribute to each link, and see if they resolve?
Example: <img src="~/images/somepic.jpg" alt="yada" runat="Server"></img>
I think there is a way to manipulate the schema in VS but I wouldn't take this approach. I think that the above syntax will work even if they are not "included" in the project - but I'm working from memory here! :-)
UPDATE:
If you look in C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas, you will see the schemas. I think it's the xhtml.xsd. In this file you will be able to find the settings for the img tag. Try updating:
<xs:attribute name="src" type="xs:string" use="required" />
精彩评论