2017-11-18 12 views
0

Jenkins、nodejs、.net core 2.0でubuntu 16.04マシンをセットアップしてから、.net core 2.0 Webアプリケーションを構築しようとしました。 、私のdevのマシンでJenkins/.net core 2.0/ubuntu missing assembly

16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Authorization". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Mvc.Abstractions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.IdentityModel.Tokens". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.IdentityModel.Tokens.Jwt". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/ForbiddenResult.cs(5,28): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(3,28): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Services/Impl/TokenManagementService.cs(10,14): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'System' (are you missing an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Services/Impl/TokenManagementService.cs(12,17): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/ForbiddenResult.cs(9,33): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/ForbiddenResult.cs(18,40): error CS0246: The type or namespace name 'ActionContext' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(8,51): error CS0246: The type or namespace name 'IActionFilter' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(33,33): error CS0246: The type or namespace name 'ActionExecutingContext' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(53,32): error CS0246: The type or namespace name 'ActionExecutedContext' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(58,24): error CS0246: The type or namespace name 'ActionExecutingContext' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj]

私は周りを見回し、それらのアセンブリを見つけることができませんでしたが、私は間違いなくそれらを参照していますので、私は、彼らが隠している推測している:それは、次のメッセージ(複数可)で失敗しましたどこかの共通の場所にある。

Jenkinsが参照するアセンブリをすべて取得してプロジェクトを正常に構築するには、何が必要ですか?私がオンラインで見たすべてのドキュメントは、.netコア1.0または1.1を参照しているようです。そして、このようなことがたくさんあるようです。

私のビルドの手順は非常に簡単です(1つあります)。実行するスクリプト:

dotnet clean 
dotnet restore 
dotnet build 
+0

ジェンキンスのビルドステップで持っているものを共有できますか? –

答えて

0

SO ITは、これが初めてのプロジェクトであなたのソリューション内のライブラリを参照すると、自動的に参照を更新した場合(おそらくReSharperのの)バグであることが判明します参照は完全に正しく追加されません。 IOW、MySolution.Commonプロジェクトは、ソリューションの一部であり、利用可能であっても、依存するアセンブリをプロジェクトファイルに明示的に追加しませんでした。

私の開発マシンではそれほど問題にはなりませんでした。 Visual Studioは依存関係をうまく見つけることができました。しかし、ビルドサーバーでは、これは欠落していた重要な情報でした。

16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Authorization". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 

は...私たちが見ることができるMySolution.Commonプロジェクトをビルドし、不足している組立時に問題が発生したこと:我々は最初のエラーを見ている場合

を修正する方法

Microsoft.AspNetCore.Authorizationであった。

この作業を行うには2通りの方法があります。 1つは手動で.csprojファイルを編集することです。あなたはそのようなPackageReferenceItemGroupに行を追加する場合:

<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="2.0.1" /> 

...(その欠落している参照用)の問題が消えます。これは私がもともとやったことであり、それは働いていたが、その後、私は、私は単に私のパッケージ管理コンソールに行くと、このような何かを行うことによって、そのファイルをいじってなくて、これを行うことができることが分かった:

cd MySolution.Common 
dotnet add reference Microsoft.AspNetCore.Authorization 

を...これは適切なバージョンとすべてと一緒にプロジェクトファイルに正しく追加されるので、これはより良い方法だと思います。

これは、これで誰かが私にかかる時間を節約してくれることを願っています。