Build failing on Azure – The reference assemblies for .NET Framework, Version=v4.7.2 were not found.

huangapple go评论64阅读模式
英文:

Build failing on Azure - The reference assemblies for .NETFramework,Version=v4.7.2 were not found

问题

错误信息如下:

错误 MSB3644:未找到.NETFramework,版本=v4.7.2的引用程序集。要解决此问题,请安装此框架版本的开发包(SDK/目标包)或重新定位您的应用程序。

这是该应用程序的GitHub链接,如果有帮助的话:https://github.com/rarDevelopment/rardk-web-dotnet

这个应用程序在本地正常运行。在Azure中设置时,我选择了.NET 7,与我的本地应用程序一致。除了在Azure中创建应用程序和部署设置时遵循的步骤之外,是否还需要配置其他内容?

英文:

I set up a deployment through Azure to deploy using a GitHub action. The action is failing with the error:

> error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application.

Here's the GitHub for the app if that helps: https://github.com/rarDevelopment/rardk-web-dotnet

This app runs just fine locally. I've selected .NET 7 when setting it up in Azure, as well as with my app locally. Is there something else I need to configure beyond the steps I follow to create the application and deployment setup in Azure?

答案1

得分: 1

The issue that you need to use actions/setup-dotnet@v3 instead of actions/setup-dotnet@v1 and do a restore before going to the build step.

EDIT: Also you need to specify the project or else it will build all of them, including the UI project, which is the one throwing the error.

  • name: Set up .NET Core
    uses: actions/setup-dotnet@v2
    with:
    dotnet-version: '7.x'
    include-prerelease: true

  • name: Install dependencies
    run: dotnet restore

  • name: Build with dotnet
    run: dotnet build --configuration Release ./rardk.web.API/rardk.web.API.csproj

  • name: dotnet publish
    run: dotnet publish ./rardk.web.API/rardk.web.API.csproj -c Release -o ${{env.DOTNET_ROOT}}/myapp

英文:

The issue that you need to use actions/setup-dotnet@v3 instead of actions/setup-dotnet@v1 and do a restore before going to the build step.

EDIT: Also you need to specify the project or else it will build all of them including the UI project which is the one throwing the error.

- name: Set up .NET Core
    uses: actions/setup-dotnet@v2
    with:
      dotnet-version: '7.x'
      include-prerelease: true

  - name: Install dependencies
    run: dotnet restore

  - name: Build with dotnet
    run: dotnet build --configuration Release ./rardk.web.API/rardk.web.API.csproj 

  - name: dotnet publish
    run: dotnet publish  ./rardk.web.API/rardk.web.API.csproj -c Release -o ${{env.DOTNET_ROOT}}/myapp

huangapple
  • 本文由 发表于 2023年2月14日 03:04:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75440202.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定