3

VisualStudioまたはMVC4をマシンにインストールせずに、MVCソリューションをテストサーバー上に構築しようとしています。

このソリューションでは、必要なすべてのMVCアセンブリをnugetパッケージと呼びます。プロジェクトでは、すべてのMVCアセンブリがコピーローカルとしてマークされています。もちろん、私の開発マシンでは、ソリューションはVisualStudioで正常に構築されます。

ビルドマシンに.netSDKをインストールし、MSBuildを使用してソリューションをビルドしようとしています。すべてのnugetパッケージはソース管理下にあり、サーバーでSVN更新を実行すると、すべてのパッケージが取得されます。

ビルドを実行すると、MVCDLLへの参照が壊れています。ソリューションではDLLが参照され、ビルドで使用するために存在するため、なぜこれが発生するのかわかりません。

これは、MSBuildによって返されるエラーのサンプルです...

DataAnnotations\RunDataAnnotationsFromModelPropertyAttribute.cs(5,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
DataAnnotations\RunDataAnnotationsFromModelPropertyAttribute.cs(12,93): error CS0246: The type or namespace name 'IClientValidatable' could not be found (are you missing a using directive or an assembly reference?)
Security\MyAuthenticateAttribute.cs(6,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Security\MyAuthenticateAttribute.cs(12,48): error CS0246: The type or namespace name 'AuthorizeAttribute' could not be found (are you missing a using directive or an assembly reference?)
Security\MyAuthorizeAttribute.cs(5,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Security\MyAuthorizeAttribute.cs(13,45): error CS0246: The type or namespace name 'AuthorizeAttribute' could not be found (are you missing a using directive or an assembly reference?)
Web\Mvc\MyLoginController.cs(7,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Web\Mvc\MyLoginController.cs(44,62): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) ...

私はこれに何時間も費やしました。それが私のマシンのビジュアルスタジオでビルドされるが、msbuildを使用するサーバーではビルドされないことは私を苛立たせます。

セス

4

3 に答える 3

5

プロジェクトを右クリックして[アンロード]をクリックし、もう一度[編集]をクリックします。

<Reference>forを見つけますSystem.Web.Mvc。が「packages」ディレクトリを参照して<HintPath>いない(または欠落している)場合は、それが問題です。パッケージとすべての参照を削除して、最初からやり直してください。

NuGetパッケージの復元では、ディスク上のファイルのみが復元され、プロジェクト参照は更新されません。

于 2012-10-06T00:18:24.910 に答える
1

「ローカルコピー」とは、リモートマシンにインストールしていないMVC3インストールからアセンブリをコピーすることを意味します。

MVC dllをプロジェクト内のフォルダー(VCSリポジトリにコミットする)にコピーし、デフォルトのインストールディレクトリからではなく、そこからすべてを参照しようとしましたか?それはうまくいくはずです。

于 2012-10-05T21:03:10.373 に答える
0

msbuildコマンドを実行する前に、ソリューションでnugetinstallを実行してみてください。VS2010以降を実行していて、nuget拡張機能を最新バージョンに更新した場合は、[プロジェクト]メニューに[Nugetパッケージの復元を有効にする]オプションがあります。これにより、ソリューションとプロジェクトファイルが、ビルドプロセスの一部としてnugetinstallを実行するように構成されます。

于 2012-10-06T05:50:57.103 に答える