Avalonia: New AvaloniaApplication template fails to build.

Created on 14 Mar 2018  路  4Comments  路  Source: AvaloniaUI/Avalonia

Creating a new project using the "Avalonia Application" template in our extension fails with the following build error:

Assets file 'D:\temp\avalonia\AvaloniaApplication19\AvaloniaApplication19\obj\project.assets.json' doesn't have a target for '.NETFramework,Version=v4.6.1/win7-x86'. Ensure that restore has run and that you have included 'net461' in the TargetFrameworks for your project. You may also need to include 'win7-x86' in your project's RuntimeIdentifiers.

Removing the net461 target fixes it, but we need to work out what is wrong here. Adding the suggested RuntimeIdentifiers doesn't seem to fix it.

bug

Most helpful comment

The following didn't work to resolve the issue in my environment:

  1. Close Visual Studio
  2. Delete bin and obj folder
  3. Open Visual Studio
  4. Build project

Still the same error as reported.

I'm using:

  • Visual Studio 2017 Professional version 15.6.3
  • Nuget package Avalonia version 0.6.1
  • Nuget package Avalonia.Desktop version 0.6.1
  • Extension Avalonia for Visual Studio version 0.6.1

Removing the net461 target resolves the problem. However, this would mean this project template may still have an issue.

Update: It doesn't matter which of the two target frameworks is remove or what sequence they are listed. As long as there is only one, it compiles. As soon as there are both, the reported error shows up.

Update 2: In my case this was related to an issue reported for ReSharper here. I updated VS to version 15.6.4 and now it compiles with both target frameworks in the project file.

All 4 comments

Actually it seems that adding the <RuntimeIdentifiers> does work, but not until after the bin and obj directories are deleted.

Nope, looking further into this, it seems that simply restarting VS causes it to build.

I can confirm that deleting the bin and obj, then restarting Visual Studio seems to be the only trick that works.

The following didn't work to resolve the issue in my environment:

  1. Close Visual Studio
  2. Delete bin and obj folder
  3. Open Visual Studio
  4. Build project

Still the same error as reported.

I'm using:

  • Visual Studio 2017 Professional version 15.6.3
  • Nuget package Avalonia version 0.6.1
  • Nuget package Avalonia.Desktop version 0.6.1
  • Extension Avalonia for Visual Studio version 0.6.1

Removing the net461 target resolves the problem. However, this would mean this project template may still have an issue.

Update: It doesn't matter which of the two target frameworks is remove or what sequence they are listed. As long as there is only one, it compiles. As soon as there are both, the reported error shows up.

Update 2: In my case this was related to an issue reported for ReSharper here. I updated VS to version 15.6.4 and now it compiles with both target frameworks in the project file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Urgau picture Urgau  路  3Comments

ZZerker picture ZZerker  路  4Comments

JonathaN7Shepard picture JonathaN7Shepard  路  4Comments

CreateLab picture CreateLab  路  3Comments

stdcall picture stdcall  路  4Comments