Assemblies not found for Visual Studio

0

Hello, I'm working with Visual Studio a short time and it's the first time I come across this message when trying to debug the program:

  (C: \ Program Files \ x86) \ Microsoft Visual Studio \ 2017 \ Community \ MSBuild \ 15.0 \ Bin \ Microsoft.Common.CurrentVersion.targets (1126,5): Error MSB3644: Reference assemblies for structure ".NETFramework, Version = v4.5" could not be found.

     

To resolve this, install the SDK or the Steering Pack for that version of the framework, or redirect the application to a version of the framework for which you have the SDK or the Steering Pack installed. Note that the assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. That way, your assembly may not be routed correctly to the intended structure. "

I would like to know what I would need to do to compile in the version that is my .NET Framework (if I am not mistaken it is in 4.7.0). I have already tried to change the version parameter to 4.7.0 in the three .config files that the program has, but the compiler still seems to reference version 4.5.

Thanks in advance for your help.

    
asked by anonymous 01.05.2018 / 08:20

1 answer

1

I've had the same problem.

Navigating to the bin folder, you can check line 1126 of the file 'Microsoft.Common.CurrentVersion.targets. Soon you come across:

<!-- By default if there is no root path set then the task will assume it is Program Files\Reference Assemblies\Microsoft\Framework-->
    <GetReferenceAssemblyPaths
        Condition="'$(TargetFrameworkMoniker)' != '' and ('$(_TargetFrameworkDirectories)' == '' or '$(_FullFrameworkReferenceAssemblyPaths)' == '')"
        TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
        RootPath="$(TargetFrameworkRootPath)"
        BypassFrameworkInstallChecks="$(BypassFrameworkInstallChecks)"
        >
      <Output TaskParameter="ReferenceAssemblyPaths" PropertyName="_TargetFrameworkDirectories"/>
      <Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="_FullFrameworkReferenceAssemblyPaths"/>
      <Output TaskParameter="TargetFrameworkMonikerDisplayName" PropertyName="TargetFrameworkMonikerDisplayName" Condition="'$(TargetFrameworkMonikerDisplayName)' == ''"/>
    </GetReferenceAssemblyPaths>
  

Probably trying to compile your application, visual studio does not   you are finding the references for such Assembler, Note the comment   before the tag GetReferenceAssemblyPaths that says if it does not   find such a reference, it must assume those within the folder    C:\Program Files\Reference Assemblies\Microsoft\Framework . if you   is referring to an Assembler that does not exist as soon as the IDE goes   generate the Exception.

To change the Target Structure of the project you can:

  
  • Right click on the project and select SubMenu Propriedades .
  •   

Tousetheversionthatdoesnotexist,justdownlaodtheFrameworkinquestion?

  • Canbestraightfrom .NET SDKs for Visual Studio
      

    Or inside the IDE itself:

         

      

01.05.2018 / 23:23