문제

We have a tool that generates some code (.cs) files that are used to build the project.

EDIT: These files are the other half of some partial classes, so the build process requires access to the source. It's not possible to compile it into a DLL, for example, and then set the build order.

The tool is run during the pre-build step, but the files are updated in the solution only after the build, which means the build needs to be performed twice to clear the errors after a change to the input.

Example:

  • Modify Tool Input File
  • Run Build
    • Tool Runs and changes source file
  • Build Fails
  • Run Build
    • Tool Runs and changes source file (but it doesn's actually change, because the input remains the same)
  • Build Succeeds

Any ideas how we can do away with the double build, and still let our tool be run from VS?

Thanks guys!

도움이 되었습니까?

해결책 3

최상의 옵션은 세분화 된 백업 / 복원을 사용하는 것입니다.

  1. 다른 이름으로 콘텐츠 데이터베이스를 복원하십시오. 기존을 덮어 쓰지 마십시오.

  2. 중앙 관리에서 백업 및 복원으로 이동 -> unattchached 콘텐츠에서 데이터 복구 데이터베이스 -> '데이터베이스 이름'에서 새로 복원 된 데이터베이스 이름을 사용하십시오. '작동'을 수행하려면 '사이트 또는 목록 내보내기'를 수행하십시오.

  3. 내보낼 사이트 및 목록을 선택하십시오. 내보내기 파일 대상을 선택하십시오.
  4. 내보내기 타이머 작업이 완료된 후 SharePoint 관리 셸에서 :

    가져 오기 -SPWEB YourSiteURL -path C : \ Storage \ invoice_list.cmp -UpdateVersions 덮어 쓰기

    이 PowerShell 스크립트는 전체 웹 또는 사이트 모음을 완전히 덮어 쓰지 않고 송장 목록 만 생성합니다. 그래서 여기서 걱정할 필요가 없습니다.

    unattached db

    unattached db

다른 팁

나는 그것을 고쳤지만, 나는 그것이 왜 그것이 처음으로 작동하지 않는지 이해하지 못한다.

나는이 기사를 찾았지만, 그것은 직접적인 답변을 제공하지 않았다 : SharePoint 2013 : 웹 응용 프로그램의 루트 사이트에 대한 액세스가 거부되었습니다

2013 년 경험이 있었던 이슈들은 (내 환경 문제는 2010 년이었습니다)이었고, 액세스가 거부 된 루트 사이트에서만 발생했습니다. 그래서 모든 하위 사이트에서 액세스가 거부 된 경우를 제외하고는 하위 사이트 중 하나에 도달 할 수 있는지 알려 드리겠습니다. 이 기사에서 Sam Weber (저자)는 다음과 같이 썼습니다 :

이 문제는 웹 응용 프로그램 인증 설정이 손상된 결과이며 익명 인증을 활성화 한 다음 해제하여 수정할 수 있습니다. 이것은 웹 응용 프로그램 인증 설정을 재활용하고 손상을 지 웁니다.

OK, 그게 흥미 롭습니다 ... 익명 액세스가 저장하고 404를 얻었습니까?!? 나는 그것을 장애로하여 그것을 다시 저장하고 내가 시작한 같은 장소에서 다시 끝났습니다. 그러나 그것이 문제가 될 수 있으면 인증 설정을 새로 고치는 것에 대해 어떻게 생각하는지 생각해보십시오. 두 영역에서 통합 인증을 비활성화하고 다시 활성화했습니다. 그리고 모든 것이 일하기 시작했습니다. 나는 아직도 그 문제가 무슨 일을 줄지 않고 지금 일하고 있습니다 ...

refactor your soln into 2 projects: the first gen's the cs file, the second uses it (as a dll).

The first project (call it Gen) has 2 post-build events: 1 to run the tool and re-create the source file, and 2) compile the Gen'ed src file for use by the 2nd project:

Gen.exe 
csc.exe /target:library Gened.cs

The second project (call it Use) references the dll and calls it.

==Gen.cs

using System.IO;
namespace sm3
{class Gen
{static string bod = "public static int var = 46;";
 static string clas = "public class Gened {" + bod + "}";
 static string ns  = "namespace sm3 {" + clas + "}";
 static void Main(string[] args)
 {StreamWriter SW;
     SW = File.CreateText("Gened.cs");
     SW.WriteLine(ns);
     SW.Close();
    }}}

==Use.cs

using System;
namespace sm3
{class Use
    {static void Main(string[] args)
        {Gened g = new Gened();
         Console.Write(Gened.var.ToString());
         Console.ReadLine();
         }}}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top