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?
Per chiarimenti, ho installato gli SDK 3.5 e 2.0 e nessuno di loro ha modificato il comportamento per questo. – Jaxidian
Hai già provato a MSBuild la tua soluzione direttamente (senza essere chiamata da NAnt)? – Filburt
Sì, lo stesso problema. – Jaxidian