8

ここで SGen 関連の他のいくつかの質問を見てきましたが、それらの回答が適用されないか、回答でこれが解決されません。この問題を修正するためにいくつかの SDK をインストールしましたが、うまくいきませんでした。参照型は、これが問題になる唯一の場所であるため、変更しないでください。SGen.exe をC:\Windows\Microsoft.NET\Framework\v3.5フォルダーに配置することをお勧めしますが、これが問題にならないボックスでは実行されていません。このシナリオでは、SGen.exeが実際に存在し、本来あるべき場所にありますが、MSBuild は何らかの理由でそれを見つけるのにまだ問題があります!

バックグラウンド:

ビルドを自動化する NAnt スクリプトがあります。このシナリオでは、NAnt が MSBuild を呼び出しており、MSBuild が SGen を見つけることができないというエラーを生成しています。プロジェクトは .NET 3.5 ベースです。スクリプトが完全に機能するプライマリ開発環境 (64 ビット Vista Ultimate) があり、それを VM (64 ビット Win 7 Ultimate) に複製しようとしています。私は準備ができているはずの点まですべてを持っていると思いますが、これは Win7 ボックスでは失敗します (Vista ボックスでは完全に動作します)。

2 つのボックスをいくつか比較しましたが、この点ではどちらも同じように見えますが、それでも失敗します。たとえば、HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFrameworksdkInstallRootv2.0値はC:\Program Files\Microsoft.NET\SDK\v2.0 64bit\両方のマシンで に設定されています。両方のマシンでSGen.exe、そのパスのbinサブディレクトリにあります。

NAnt スクリプト:

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

私が得るエラーメッセージはこれです:

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 をまだ見つけられない原因となっている、ここで間違っていることは何ですか?

4

4 に答える 4

18

これは、最近私自身が遭遇した一般的な問題のようです。

[ビルド] タブのプロジェクト プロパティで、[シリアライゼーション アセンブリの生成] オプションを [自動] から[オフ] に設定します。


アップデート

まだ試していない場合は<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>、Release AND Debug 構成に設定されていることを確認してください。

于 2010-04-08T17:28:26.073 に答える
0

古いバージョンの VS をインストールする手間がかからない解決策があると思います

次のことを試してください。

キー: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v2.0\

文字列値: 名前: InstallationFolder 値 (デフォルト): C:\Program Files (x86)\Microsoft.NET\SDK\v2.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
于 2016-01-26T10:27:10.157 に答える
0

[ビルド] タブのプロジェクト プロパティで、[シリアル化アセンブリの生成] オプションを [自動] から [オフ] に設定します。

それは私の問題を解決しました。

于 2017-06-22T06:37:43.560 に答える
-2

なぜこれが起こったのかはわかりませんが、これを回避するために Visual Studio 2005 をインストールすることでした。すでに .NET 2.0 SDK と .NET 3.5 SDK をインストールしていましたが、うまくいきませんでした。 Visual Studio 2005 インストーラーがこの問題を解決してくれました。これは恐ろしい解決策ですが、それでも解決策でした。

うまくいけば、すぐに .NET 4.0 に移行して、.NET 2.0 とその問題を完全に取り除くことができます。

于 2010-04-08T19:00:27.103 に答える