How do I compile an XNA project from C# with MSBuild 14? -
i have xna project have compiles fine in visual studio 2015, makes use of c# 6 features.
previously, had tools coded in c# auto-compile project when using c# 5 under vs 2013, change c# 6 has broken things somehow.
to reproduce created new console application, referenced microsoft.build
, microsoft.build.framework
, , microsoft.build.utilities.core
assemblies c:\program files (x86)\msbuild\14.0\bin
.
i created c# compiler project following code:
namespace compilexna { class program { static void main(string[] args) { const string solutionpath = @"d:\code\my projects\frbtest\frbtest.sln"; var properties = new dictionary<string, string>() { {"configuration", "debug"}, {"platform", "x86" } }; var parameters = new buildparameters { loggers = new ilogger[] {new buildlogger()} }; var request = new buildrequestdata(solutionpath, properties, null, new string[] {"build"}, null); var manager = buildmanager.defaultbuildmanager.build(parameters, request); console.writeline("done"); console.readline(); } } class buildlogger : logger { public override void initialize(ieventsource eventsource) { eventsource.errorraised += (sender, args) => console.writeline($"error: file {args.file} line {args.linenumber} message {args.message}"); eventsource.warningraised += (sender, args) => console.writeline($"warning: file {args.file} line {args.linenumber} message {args.message}"); } } }
unfortunately, when runs following error:
error: file c:\program files (x86)\msbuild\microsoft\xna game studio\v4.0\microsoft.xna.gamestudio.contentpipeline.targets line 78 message "buildcontent" task not instantiated assembly "microsoft.xna.framework.content.pipeline, version=4.0.0.0, culture=neutral, publickeytoken=842cf8be1de50553". please verify task assembly has been built using same version of microsoft.build.framework assembly 1 installed on computer , host application not missing binding redirect microsoft.build.framework. unable cast object of type 'microsoft.xna.framework.content.pipeline.tasks.buildcontent' type 'microsoft.build.framework.itask'.
i tried looking in details of build output in visual studio 2015 when compiles xna project, detailed logging find (seemingly) relevant was:
1>using "buildcontent" task assembly "microsoft.xna.framework.content.pipeline, version=4.0.0.0, culture=neutral, publickeytoken=842cf8be1de50553". 1>task "buildcontent" 1>done executing task "buildcontent".
anyone have success on this?
Comments
Post a Comment