none
change a .net 4.6.1 project to .net 4.7 failed RRS feed

  • Question

  • Hi ,

    when I change the targetting from .net 4.6.1 to .net 4.7 .

    I get this error when build , but there is no project .json  , how can I pass this? project cannot compile now.

    Severity    Code    Description    Project    File    Line    Suppression State
    Error        Your project is not referencing the ".NETFramework,Version=v4.7" framework. Add a reference to ".NETFramework,Version=v4.7" in the "frameworks" section of your project.json, and then re-run NuGet restore.  


    Gordon

    Wednesday, September 6, 2017 9:55 AM

Answers

  • there is no project.json file on project folder.

    I have fixed it by create brand new project with .net 4.7 and then copy the files from old project.

    this works but not a good solution , as I should be able to just right click the project and change it from 4.6.1 to 4.7.


    Gordon

    • Marked as answer by Gordon Liq Thursday, September 7, 2017 5:27 AM
    Thursday, September 7, 2017 5:26 AM

All replies

  • Hi Gorden, 

    Your project does not have a refrence .net framework 4.7.

    Have you tried to restore the  nuget packages?

    Friendly regards.

    Laurens

    Don't forget to mark an answer or vote is as helpfull

    Wednesday, September 6, 2017 10:52 AM
  • yes I did it by delete the package folder.

    the launch the solution and build again .

    but the error remains


    Gordon

    Wednesday, September 6, 2017 11:33 AM
  • Gorden , 

    have already installed the .net framework? 

    And what are the versions of the packages nuget restored?

    https://www.microsoft.com/en-us/download/details.aspx?id=55170

    friendly regards

    Laurens

    Don't forget to mark an answer or vote is as helpful


    • Edited by laurens vdb Wednesday, September 6, 2017 11:43 AM
    Wednesday, September 6, 2017 11:42 AM
  • yes .net 4.7 already installed , I download the offline package and try install again and it said it is already installed.

    how do I check which version of the packages nuget restored?


    Gordon

    Wednesday, September 6, 2017 11:45 AM
  • What version are you using of visual studio? 

    the 2017?

    Wednesday, September 6, 2017 11:48 AM
  • 2017 15.3.3

    Gordon

    Wednesday, September 6, 2017 11:49 AM
  • Hi Gordon,

    Thank you for posting in MSDN forum.

     >> Your project is not referencing the ".NETFramework,Version=v4.7" framework. Add a reference to ".NETFramework,Version=v4.7" in the "frameworks" section of your project.json

    According to this error, did you check you proj.json file and make sure that you add the V.47 reference ?

    Please see mapping between project.json and csproj properties :

    During the development of the .NET Core tooling, an important design change was made to  no longer support project.json files and instead move the .NET Core projects to the MSBuild/csproj  format.

    Did you try to build a .Net core project or any other types? To have a better understanding of this issue, please tell us your project type and the steps you did of this project.

    So that I can try to reproduce this issue on my VS 2017 15.3.3 .

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 7, 2017 5:23 AM
    Moderator
  • there is no project.json file on project folder.

    I have fixed it by create brand new project with .net 4.7 and then copy the files from old project.

    this works but not a good solution , as I should be able to just right click the project and change it from 4.6.1 to 4.7.


    Gordon

    • Marked as answer by Gordon Liq Thursday, September 7, 2017 5:27 AM
    Thursday, September 7, 2017 5:26 AM
  • Hi Gordon,

    Thank you for your update.

    Glad to hear that you solved this issue successfully and it's very kind of you for sharing us your solution here.

    Have a good day:)

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 7, 2017 5:46 AM
    Moderator
  • Solution : delete the obj folder in the project and rebuild

    Details:
    The Obj directory contains "project.assets.json" which contains a lot of targeting information, 
      "version": 2,
      "targets": {
        ".NETFramework,Version=v4.5.2": {},
        ".NETFramework,Version=v4.5.2/win": {},
        ".NETFramework,Version=v4.5.2/win-x64": {},
        ".NETFramework,Version=v4.5.2/win-x86": {}
      },
      "libraries": {},
      "projectFileDependencyGroups": {
        ".NETFramework,Version=v4.5.2": []
      },
      "packageFolders": {
        "C:\\Users\\bruce\\.nuget\\packages\\": {}
      },
    Removing this, and rebuilding did not recreate this file, nor several other files seemingly related to it, so I would caution making a backup first. 
    • Edited by bruceburge Wednesday, September 20, 2017 4:06 PM Found Solution
    Wednesday, September 20, 2017 3:19 PM
  • I also deleted the bin folder.
    Wednesday, November 8, 2017 12:38 PM
  • Thanks! Works for me.
    Tuesday, December 12, 2017 6:28 AM
  • you should delete your obj folder.

    Please refer to:

    https://developercommunity.visualstudio.com/content/problem/10334/your-project-is-not-referencing-the-netframeworkve.html


    Monday, May 14, 2018 10:16 PM