2010-04-08 22 views
6

Ho esaminato molte altre domande relative a SGen qui e le loro risposte non si applicano o le loro risposte non risolvono questo problema per me. Ho installato diversi SDK per risolvere questo problema senza fortuna. I tipi di riferimento non dovrebbero essere modificati poiché questo è l'unico posto in cui questo è un problema. Una volta suggerito è di mettere SGen.exe nella cartella C:\Windows\Microsoft.NET\Framework\v3.5, ma non è stato fatto sulla scatola dove questo non è un problema. In questo scenario, SGen.exe esiste ed è esattamente dove dovrebbe essere, ma MSBuild ha ancora problemi a trovarlo per qualche motivo!MSBuild non riesce a trovare SGen durante la compilazione di una soluzione

Background:

Abbiamo uno script NAnt che consente di automatizzare il nostro costruisce. In questo scenario, NAnt sta chiamando MSBuild e MSBuild sta generando l'errore sostenendo di non riuscire a trovare SGen. Il progetto è basato su .NET 3.5. Ho il mio ambiente di sviluppo primario (Vista Ultimate a 64 bit) in cui lo script funziona perfettamente e sto tentando di duplicarlo in una VM (64 bit Win 7 Ultimate). PENSO Ho tutto al punto in cui dovrei essere bravo ma questo non funziona sulla scatola di Win7 (funziona perfettamente sulla confezione di Vista).

Ho effettuato alcuni confronti tra le due caselle e sono entrambi look identici a questo proposito, ma non riesce ancora. Ad esempio, il valore è impostato su C:\Program Files\Microsoft.NET\SDK\v2.0 64bit\ su entrambe le macchine. In entrambe le macchine, SGen.exe si trova nella sottodirectory bin di quel percorso.

NAnt script:

messaggio
<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> 

L'errore che ottengo è questo:

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) 

Che cosa sto facendo male qui che sta causando MSBuild di essere ancora in grado di trovare SGEN?

+0

Per chiarimenti, ho installato gli SDK 3.5 e 2.0 e nessuno di loro ha modificato il comportamento per questo. – Jaxidian

+0

Hai già provato a MSBuild la tua soluzione direttamente (senza essere chiamata da NAnt)? – Filburt

+0

Sì, lo stesso problema. – Jaxidian

risposta

-2

Non sono sicuro di cosa o perché stia succedendo, ma quello che ho fatto per aggirare questo problema è stato l'installazione di Visual Studio 2005. Avevo già installato .NET 2.0 SDK e .NET 3.5 SDK senza fortuna ma qualcosa con il programma di installazione di Visual Studio 2005 risolse questo problema per me. Questa è una soluzione ORRIBILE, ma è stata, nondimeno, una soluzione.

Speriamo di poter presto migrare a .NET 4.0 e di completare .NET 2.0 e i suoi problemi.

16

Questo sembra essere un problema comune a cui mi sono imbattuto in questi giorni.

Nelle proprietà del progetto sulla scheda "Build" impostare l'opzione "Genera assembly di serializzazione" da "Auto" a "Off ".


aggiornamento

Se non già provato, assicurarsi che <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> sono destinati per la configurazione di rilascio e di debug.

+0

Ho provato questo e non c'era alcun cambiamento nel comportamento. Questa parte del mio script di compilazione è una soluzione a progetto singolo e ho esaminato il file '.csproj' e contiene' Off 'da quando ho cambiato l'impostazione, ma ottengo lo stesso errore. – Jaxidian

+0

Per rispondere al tuo aggiornamento: ci avevo pensato e non era un problema. – Jaxidian

+1

Grazie Filburt, che funziona per me, non sono sicuro di cosa farei se avessi bisogno di SerializationAssemblies. : -] – Myster

0

Penso che ci sia una soluzione senza il dolore di installare vecchie versioni di VS

prova le seguenti:

chiave: HK EY_LOCAL_MACHINE \ SOFTWARE \ Microsoft.NETFramework \ v2.0 \

Valore stringa: Nome: InstallationFolder valore (default): C: \ Program Files (x86) \ Microsoft.NET \ SDK \ v2.0 \

o salvare questo file come codice di reg ed eseguire:

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

Nelle proprietà del progetto sulla scheda "Build" impostare l'opzione "Genera assembly di serializzazione" da "Auto" su "Off".

Ha risolto il problema.