0

クライアントに .wsp ファイルを渡す必要があります

機能内に .stp を含め、その機能を他のファイルと一緒に含めて .wsp ファイルを作成する方法の例を教えてください。

手順が示されている多くのサイトにアクセスしましたが、.dlls ファイル、カスタム イベント レシーバー機能、カスタム Web パーツ、サイト テンプレート .stp ファイルなど、さまざまなファイルを含める必要があるため、アプローチ方法がわかりません。 . manifest.xml ファイルの正確な要素名または構文を確認できる例が 1 つ必要です。例: .dll ファイルをインクルードしてデルピーするには、アセンブリ要素を使用し、同様に FeaturesMainfest 要素を機能に使用します。

これについて私を助けてくださいありがとうアブドゥル・アフローズ

4

1 に答える 1

0

アブドゥル

次の例を見てください。これがメインの manifest.xml ファイルになります。

    <?xml version="1.0" encoding="utf-8"?>
<!-- Solution created by WSPBuilder. 10/21/2010 11:22:17 AM  -->
<Solution xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SolutionId="c0096412-9324-4bc5-a411-652d319efe59" xmlns="http://schemas.microsoft.com/sharepoint/">
  <FeatureManifests>
    <FeatureManifest Location="xxxxxxx\feature.xml" />
  </FeatureManifests>
  <Assemblies>
    <Assembly Location="xxxxxxxxxxxx.dll" DeploymentTarget="GlobalAssemblyCache" />
  </Assemblies>
  <TemplateFiles>
    <TemplateFile Location="LAYOUTS\xxxxxxx\xxxxxxx.asmx" />
  </TemplateFiles>
  <Resources>
    <Resource Location="xxxxxxx\ListTemplates\xxxxxxx.stp" />
  </Resources>
</Solution>

また、フィーチャー レシーバー クラスでは、テンプレート ファイルをテンプレート ドキュメント ライブラリにアップロードする必要があります。これは非常に簡単な例です。

private void UploadTemplates(SPDocumentLibrary templateGallery, string[] templateFiles)
        {
            try
            {
                if (templateGallery != null)
                {
                    foreach (string str in templateFiles)
                    {

                    FileInfo info = new FileInfo(str);
                    SPQuery query = new SPQuery();
                    query.Query = string.Format("<Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='Text'>{0}</Value></Eq></Where>", info.Name);
                    SPListItemCollection items = templateGallery.GetItems(query);
                    int[] numArray = new int[items.Count];
                    for (int i = 0; i < items.Count; i++)
                    {
                        numArray[i] = items[i].ID;
                    }
                    for (int j = 0; j < numArray.Length; j++)
                    {
                        templateGallery.Items.DeleteItemById(numArray[j]);
                    }
                    byte[] file = File.ReadAllBytes(str);
                    templateGallery.RootFolder.Files.Add(info.Name, file);
                }
            }
            else
            {
                 // templateGallery is null
            }
        }
        catch (Exception exception)
        {
          // handle your errors
        }
    }
于 2010-11-26T14:21:37.430 に答える