2017-09-05 38 views
4

我遇到了一些新創建的Azure函數項目(新的預編譯版本)的麻煩。這是我在VS2017中用模板創建的一個TimerTrigger函數。無法從dotnet CLI構建Azure函數項目

它建立在Visual Studio中就好了,但是當我嘗試用.NET核心CLI(的MSBuild)來構建它,我得到以下錯誤:

C:\Users\f00.nuget\packages\microsoft.net.sdk.functions\1.0.2\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets(31,5): error : Could not load file or assembly 'Microsoft.Azure.WebJobs.Extensions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. [C:\Repos\Test\testproject\src\functions-project\functions-project.csproj]

Version: "Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core"

我的猜測是從內部建立時VS使用不同版本的msbuild或不同的配置。但我不知道如何解決它。這裏的最終目標是能夠與Appveyor一起構建和部署,但我當然會遇到同樣的錯誤。

更新

我試圖創建一個新的功能項目,並從頭開始TimerTrigger,但無濟於事 - 再次得到同樣的錯誤。我甚至嘗試創建一個HttpTrigger,但沒有工作,要麼:(

+0

嘗試建設CLI之前運行'DOTNET restore'。就AppVeyor而言,它是'before_build'腳本。 – ilyaf

+0

對我而言不適用 –

回答

0

由於ilyaf文件檔案化管理,我們需要添加之前構建腳本dotnet restore,我測試它在我的身邊,它的工作原理corretly。以下是我的詳細步驟。

1,創建與VS2017模板的Azure的功能項目。

它2.Push到github上。

3.添加該項目Appveyor

enter image description here

4.設置環境和建立

enter image description here

enter image description here

  • 檢查它成功構建。
  • enter image description here

    enter image description here

    +0

    感謝您的詳細解答。但是,在dotnet構建之前運行dotnet恢復會產生相同的結果。我想我將不得不求助於創建一個全新的功能項目,看看我能否得到不同的結果。乾杯! –