Reputation: 4014
I have created a simple C# .net core console application project in VS MacOS. But I get error MSB4057. There a similar question on stackoverflow but doesn't explain anything how to fix this kind of error.
The problem is same when I create asp.net core project.
Build FAILED.
/Users/abhimanyuaryan/Unity3D/LearnCSharp/LearnCSharp/LearnCSharp.csproj : error MSB4057: The target "Build" does not exist in the project.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.02
---------------------- Done ----------------------
Build: 1 error, 0 warnings
Upvotes: 7
Views: 6032
Reputation: 151
I found this same issue when I downloaded the Xamarin mobile-samples from GitHub. This occurred in some of the shared library projects. Inside the project file (.csproj), the Project tag will have a DefaultTargets attribute of Build.
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
At the bottom of iOS and Android project files, there will be Import tags which include the Build template instructions.
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
or
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
However, some common library projects are missing the appropriate C# build instructions. The missing tag is:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
To fix this:
Upvotes: 0
Reputation: 63123
It is very important to upgrade Mono 4.8 to its latest build, (in my case)
Then the bundled build environment can successfully compile the project.
It seems the built in updater does not upgrade Mono runtime as expected.
Updated: Now the installer should assist you install Mono 5.0 automatically.
Upvotes: 12