素晴らしい人々の助けが必要です。そこで、次のことを行う Visual Studio 2012 用のアドインを作成しました。
.aspx 拡張子ファイルが画面で開いているときに、アドインを押したとき
1) App_LocalResources フォルダーに既に存在するリソース ファイルがあるかどうかを確認します。
If Resource file exists:
It will compare the .aspx file and the resource file and if something
is missing in the resource file it will add it
If Resource file does not exist:
First it will create a new resource file. After that it will check
the meta:resourcekeys on the aspx file and add them to the resource file
after that it should add the file to the project under the
App_LocalResources folder
ここが私が立ち往生している場所です。私が使用AddFromFileすると、常に.aspxファイルの下にファイルが追加されます。というページで作業していてDefault.aspx、アドインを押したとします。私のアドインは を見つけて、meta:resourcekeys実際にフォルダに作成された新しく作成されたリソース ファイルに追加しますApp_LocalResources。その後、プロジェクトに追加すると、フォルダーの下に追加されApp_LocalResourcesず、代わりに の下に追加されDefault.aspxます。両方試してみましたがAddExistingItem 、 AddFromFile結果は同じでした。誰でも私を助けることができますか?
編集:わかりましたので、このコードを使用してファイルをプロジェクトに追加しました:
var currentObj = _applicationObject.ActiveDocument;
currentObj.ProjectItem.ProjectItems.AddFromFile(FilePath);
私は ActiveDocument を使用しているので、作業中であるため、Default.aspxファイルの下にファイルが追加されます。これを変更する方法はありますか?