I have a .Net solution with two simple class library projects. Both projects contain a single method like hello world.
Solution is getting build properly using visual studio as well as MSBuild.exe.
Now when I make a reference of Project 1 into Project-2 then its start creating problem.
Solution are getting build properly using visual studio but not via MSBuild.
Please refer attached screen shot.
Is there any specific things that we need to do withing solution before building using MSBuild ?
(_GetProjectReferenceTargetFrameworkProperties target) -> C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1657,5): error MSB4036: The "GetReferenceNearestTargetFrameworkTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin" directory. [D:\DevOps\Sample-Projects\DevOpsSoln\DummyClass\DummyClass.csproj]
One more thing is there any specific parameter that I need to supply on msbuild console like:
C:Programfile\MsBuild.exe *.sln file path (Any Specific parameter)
Note: My solutions have only DLL based projects.
Changes required in Visual studio solution project for MSBuild
To resolve this issue, please try to install Nuget Package Manager with Installer:
Download open the Build Tools for Visual Studio 2017.
Switch to the "Individual Components" tab
Tick the "NuGet package manager" check-box that is under "Code tools" option.
Click Install to install it.
Screenshot of where this is located:
That should fix the error you see in this question. If it's not working, see the answers from this question.
Hope this helps.