Surprising MSB4057 error

I have a solution, MySolution.sln, with several c# project (MyProj.csproj, My.Other.Proj.csproj)

This works:

msbuild MySolution.sln /nologo /t:MyProj

But this fails with MSB4057 (the target does not exist in the project):

msbuild MySolution.sln /nologo /t:My.Other.Proj

So, what could possibly be the difference between the two projects?

The dots!

There are two solutions for this:

1. replace the dot with underscore in the command-line (found in this thread). I wonder who was the first person who actually figured it out, and how.

msbuild MySolution.sln /nologo /t:My_Other_Proj

2. replace the internal project name in the .sln file to something without dots, and use it:


Project(“{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}”) = “My.Other.Proj”, “My.Other.Proj.csproj”, “{DAAA327B-E461-4BC0-A331-D32208C1D94C}”


Project(“{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}”) = “MyOtherProj”, “My.Other.Proj.csproj”, “{DAAA327B-E461-4BC0-A331-D32208C1D94C}”

Then build using the new, non-dotted name:

msbuild MySolution.sln /nologo /t:MyOtherProj

Thank you again, Microsoft, for keeping me busy with your unexplained, undocumented, and non-intuitive little features.

1 thought on “Surprising MSB4057 error

  1. Pingback: vSphere PowerCLI Fails to Launch | Adventures in SCM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s