0

나는 당신에게 멋진 도움이 필요합니다. 그래서 나는 다음을 수행 비주얼 스튜디오 2012에 대한 추가 기능 제작 : 확장명이 .aspx 파일이 화면에 열려있는 경우C# : 프로젝트의 특정 폴더에 기존 파일 추가하기

을 당신은 추가 기능

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 아래에 추가됩니다. 나는 AddExistingItemAddFromFile을 시도했는데 같은 결과가 나왔습니다. 누구든지 나를 도울 수 있습니까?

편집 : 나는에서는 ActiveDocument를 사용하고 있기 때문에

var currentObj = _applicationObject.ActiveDocument; currentObj.ProjectItem.ProjectItems.AddFromFile(FilePath);

그것이 파일 기본에서 파일 을 추가 : 좋아 그래서 난 내 프로젝트에 파일을 추가하려면이 코드를 사용하고 .aspx 왜냐하면 나는 그것에 종사하고있어. 이걸 바꿀 방법이 있니?

답변

0

아마 사용해보십시오 :

을 currentObj.ProjectItem.ContainingProject
관련 문제