2010-04-08 7 views
6

다른 SGen 관련 질문을 여기에서 살펴 보았습니다. 대답이 적용되지 않거나 답변으로 해결할 수 없습니다. 행운이 문제를 해결하기 위해 몇 가지 SDK를 설치했습니다. 참조 유형은 이것이 유일한 문제이기 때문에 변경하면 안됩니다. 한 번 제안은 C:\Windows\Microsoft.NET\Framework\v3.5 폴더에 SGen.exe를 넣는 것이지만 문제가되지 않는 상자에서는 완료되지 않았습니다. 이 시나리오에서는 SGen.exe이 실제로 존재하며 올바른 위치에 있지만 MSBuild는 여전히 웬일인지 찾아야하는 문제가 있습니다!솔루션을 컴파일 할 때 MSBuild에서 SGen을 찾을 수 없습니다.

배경 :

우리는 우리의 빌드 자동화은 NAnt 스크립트가 있습니다. 이 시나리오에서 NAnt는 MSBuild를 호출하고 MSBuild는 SGen을 찾을 수 없다는 오류를 생성합니다. 이 프로젝트는 .NET 3.5 기반입니다. 나는 스크립트가 완벽하게 작동하고 VM (64 비트 Win 7 Ultimate)에서 복제하려고 시도하는 주 개발 환경 (64 비트 Vista Ultimate)이 있습니다. 나는 내가 잘해야 할 시점까지 모든 것을 가지고 있다고 생각하지만 이것은 Win7 박스에서 실패한다. (Vista 박스에서 완벽하게 작동한다.)

두 상자 사이의 비교를 수행했으며 모두 이 점에 관해서는 같아 보이지만 여전히 실패합니다. 예를 들어 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFrameworksdkInstallRootv2.0 값은 두 시스템 모두에서 C:\Program Files\Microsoft.NET\SDK\v2.0 64bit\으로 설정됩니다. 두 시스템에서 SGen.exe은 해당 경로의 bin 하위 디렉토리에 있습니다.

은 NAnt 스크립트 : 내가 잘못 여기에 원인이되는 그 무엇을하고 있는가

report-installer: 

    [exec] Microsoft (R) Build Engine Version 3.5.30729.4926 
    [exec] [Microsoft .NET Framework, Version 2.0.50727.4927] 
    [exec] Copyright (C) Microsoft Corporation 2007. All rights reserved. 
    [exec] 
    [exec] Build started 4/8/2010 11:28:23 AM. 
    [exec] Project "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.sln" on node 0 (default targets). 
    [exec] Building solution configuration "Release|Any CPU". 
    [exec] Project "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.sln" (1) is building "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.csproj" (2) on node 0 (default targets). 
    [exec] Could not locate the .NET Framework SDK. The task is looking for the path to the .NET Framework SDK at the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK. 2.) Manually set the above registry key to the correct location. 
    [exec] CoreCompile: 
    [exec] Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files. 
    [exec] C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1902,9): error MSB3091: Task failed because "sgen.exe" was not found, or the .NET Framework SDK v2.0 is not installed. The task is looking for "sgen.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK v2.0. 2.) Manually set the above registry key to the correct location. 3.) Pass the correct location into the "ToolPath" parameter of the task. 
    [exec] Done Building Project "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.csproj" (default targets) -- FAILED. 
    [exec] Done Building Project "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.sln" (default targets) -- FAILED. 
    [exec] 
    [exec] Build FAILED. 
    [exec] 
    [exec] "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.sln" (default target) (1) -> 
    [exec] "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.csproj" (default target) (2) -> 
    [exec] (GenerateSerializationAssemblies target) -> 
    [exec] C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1902,9): error MSB3091: Task failed because "sgen.exe" was not found, or the .NET Framework SDK v2.0 is not installed. The task is looking for "sgen.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK v2.0. 2.) Manually set the above registry key to the correct location. 3.) Pass the correct location into the "ToolPath" parameter of the task. 
    [exec] 
    [exec]  0 Warning(s) 
    [exec]  1 Error(s) 
    [exec] 
    [exec] Time Elapsed 00:00:00.24 
    [call] C:\Projects\Production\Source\reports.build(15,4): 
    [call] External Program Failed: C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe (return code was 1) 

MSBuild를 정지 SGen을 찾을 수 없습니다로 : 내가 얻을

<target name="report-installer" depends="fail-if-environment-not-set"> 
    <exec program="MSBuild.exe" basedir="${framework35.directory}"> 
     <arg value="${tools.directory.current}\ReportInstaller\ReportInstaller.sln" /> 
     <arg value="/p:Configuration=${buildconfiguration.current}" /> 
    </exec> 
</target> 

오류 메시지가이 무엇입니까?

+0

설명을 위해 3.5 및 2.0 SDK를 설치했으며 이것에 대한 동작을 변경하지 않았습니다. – Jaxidian

+0

NAnt에서 호출하지 않고 솔루션을 직접 MSBuild하려고 했습니까? – Filburt

+0

그래, 같은 문제. – Jaxidian

답변

-2

왜 이런 일이 발생했는지 모르겠지만이 문제를 해결하기 위해 Visual Studio 2005를 설치해야했습니다. 이미 .NET 2.0 SDK뿐만 아니라 .NET 3.5 SDK도 설치 했었습니다. 하지만 Visual Studio 2005 설치 ​​프로그램에서이 문제가 해결되었습니다. 이것은 까다로운 해결책이지만 그럼에도 불구하고 해결책이었습니다.

곧 .NET 4.0으로 마이그레이션하여 .NET 2.0 및 그 문제점을 제거 할 수 있기를 바랍니다.

16

이것은 내가 최근에 나 자신을 만났던 일반적인 문제인 것처럼 보입니다. 은 "빌드"탭에서 프로젝트 속성에서

이 옵션을 " Off"를 "자동"에서 "직렬화 어셈블리 생성"을 설정합니다. 아직 시도하지 않으면


갱신

, <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> 릴리스 및 디버그 구성에 설정되어 있는지 확인하십시오.

+0

나는 이것을 시도했지만 행동에는 변화가 없었다. 이 빌드 스크립트의 일부는 단일 프로젝트 솔루션이며'.csproj' 파일을 살펴본 결과,이 설정을 변경했을 때' Off'가 포함되어 있지만 정확히 동일한 오류가 발생합니다. – Jaxidian

+0

업데이트에 응답하려면 다음과 같이 생각했습니다. 문제가되지 않았습니다. – Jaxidian

+1

감사합니다 Filburt, 그게 나를 위해 일하는, 확실하지 않은 경우 SerializationAssemblies 필요 했어. : - – Myster

0

내가

다음 시도하십시오 VS의 이전 버전을 설치하는 고통이없는 해결책이 생각 :

  • 다운로드 + .NET 프레임 워크 2.0 소프트웨어 개발 키트 (SDK) (86)를 설치가 : 키

: HK를 https://www.microsoft.com/en-us/download/details.aspx?id=19988

  • 은 반드시 다음과 같은 REGKEY이 존재하게 EY_LOCAL_MACHINE의 \ 소프트웨어 \ Microsoft.NETFramework의 \ 2.0 \

    문자열 값 : 이름 : InstallationFolder 값 (기본값) : C :

    \ \의 Program Files (x86)를 \ Microsoft.NET \ SDK의 \ 2.0

    또는이 코드를 같은 .reg 파일을 저장하고 실행 : 프로젝트 속성에서

    Windows Registry Editor Version 5.00 
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0] 
    "InstallationFolder"="C:\\Program Files (x86)\\Microsoft.NET\\SDK\\v2.0 
    
  • 0

    을 "빌드"탭은 옵션 "자동"에서 "직렬화 어셈블리를 생성"을 "Off"로 설정하십시오.

    해결 된 내 문제.

    관련 문제