2
\$\begingroup\$

I am working with an XNA content loader sample. In the references for the project (VS 2010 Express) there are:

  • Microsoft.Build
  • Microsoft.Build.Framework

    //as well as the standard XNA framework and graphics references

To emulate this project, I am trying to first add a reference to Microsoft.Build.dll. But Visual Studio warns me that it cannot load the .dll. I looked at MSDN and the document referenced Microsoft.Build.Evaluation. This is suppose to be available in the Microsoft.Build.dll and then I'll have access to the Project class.

Has anyone had any experience with this?

\$\endgroup\$
1
  • \$\begingroup\$ I personally think that this should be moved to StackOverflow. \$\endgroup\$
    – DeadMG
    Jan 28 '11 at 8:57
3
\$\begingroup\$

Make sure to change the project's target .Net Framework from .Net 4 Client Profile to .Net 4. The client framework does not include MSBuild.

To do this open the project properties, select the Application tab, and change the Target Framework dropdown to ".Net Framework 4".

\$\endgroup\$
1
  • \$\begingroup\$ I finally figured this out about MSBuild. A very interesting library. My guess, and my hope, is that this gets set as a standard piece of the .Net library some time in a future release. \$\endgroup\$
    – IAbstract
    Jan 28 '11 at 21:58
1
\$\begingroup\$

If for some reason you have the infamous .NET bug where the Target Framework box is greyed out and you are stuck in Client mode, you can force VS2010 to use the full framework by opening the .csproj file in a texteditor and then make sure that this line:

<TargetFrameworkProfile></TargetFrameworkProfile>

is empty.

Worked for me, now Microsoft.Build is available to reference in the project.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.