2

I'm using SharePoint 2010 Foundation and Visual Studio 2010 Ultimate. I'm working on a Web Parts with two features:

  1. Feature1 - My Web Parts
  2. Feature2 - Contains two Visual Studio module with CSS and JavaScript and jQuery code.

When I deploy my Solution by Visual Studio I have this error:

Error occurred in deployment step 'Activate Features': Failed to instantiate file "path1/path2/picture1.png" from module "MyModule": The specified list does not exist.

Can anyone help me?

Thanks

[Edit - 1]

Hi. This is my element.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="MyModule" Url="CssScripts/Css">
    <File Path="MyModule\path1\path2\Picture1.png" Url="path1/path2/Picture1.png" Type="GhostableInLibrary" />
    <File Path="MyModule\path1\path2\Picture2.png" Url="path1/path2/Picture2.png" Type="GhostableInLibrary" />
    <File Path="MyModule\path1\path2\Picture3.png" Url="path1/path2/Picture3.png" Type="GhostableInLibrary" />
     ...
</Module>
</Elements>
  • 1
    The problem seems to be in your Elements.xml file of MyModule.. Please add that in your question – Arsalan Adam Khatri Mar 11 '14 at 11:37
2
  1. Make sure the document library "DbShopCssScripts" exists.path1,path2 should not be present inside the url, unleass you want it to be deployed inside path1 folder in the site (ie DbShopCssScripts/Css/path1).

Below is link msdn article ablout uploading file from solution to document library. http://msdn.microsoft.com/en-us/library/ee231567.aspx

  • The name of library is "DbShopCssScripts1" but the description is "DbShopCssScripts". Thanks for your answer. – ilMattion Mar 11 '14 at 13:07
  • Can you give me any articles that explains this, please? – variable Mar 19 '14 at 6:36
1

If you are not deploying to a library your should change "GhostableInLibrary" to "Ghostable". If you are in fact deploying to a library, make sure the specified subfolders do exist

1
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="MyModule" Url="DbShopCssScripts/Css">
    <File Path="Picture1.png" Url="Picture1.png" Type="GhostableInLibrary" />
    <File Path="Picture2.png" Url="Picture2.png" Type="GhostableInLibrary" />
    <File Path="Picture3.png" Url="Picture3.png" Type="GhostableInLibrary" />
     ...
</Module>
</Elements>

The above should work

Explanation

When you define the Url in <Module> element, you don't need to define it again in <File> element, unless you want it deployed in Sub-Folder to the path defined in <Module> element

  • Hi Arsalan, can you give some reference link/article to this concept.. – variable Mar 11 '14 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.