1

Good Afternoon

I am having issues with the BuildManager class when building a project that contains a .licx file for a third party krypton component that I am using.

My compiler is written in .Net 4.5 whilst the target build project is .Net 2.0.

The target project produces the following message when trying to build through build manager.

Unable to resolve type 'ComponentFactory.Krypton.Navigator.KryptonNavigator, ComponentFactory.Krypton.Navigator, Version=2.6.1.0, Culture=neutral, PublicKeyToken=[Licence]

It builds fine from visual studio and I have put the components into a .Net 4.5 application and that also builds so I am assuming that the issue is a conflict with the components on .Net 2. I am unable to upgrade this project.

I am hoping that it is just an attribute for the build manager required, but I cannot find much documentation on it.

Here is my code for the build

String[] args = (String[])e.Argument;
        String SolutionFile = args[0];
        String TargetPath = args[1];
        String LogFilePath = args[2];


        ProjectCollection pc = new ProjectCollection();
        Dictionary<String, String> GlobalProperty = new Dictionary<String, String>();
        BasicFileLogger log = new BasicFileLogger();
        log.Parameters = LogFilePath;
        log.register();

        GlobalProperty.Add("Configuration", "Release");
        GlobalProperty.Add("Platform", "Any CPU");
        GlobalProperty.Add("OutputPath", TargetPath);
        GlobalProperty.Add("AllowUnsafeBlocks", "true");
        GlobalProperty.Add("Optimize", "true");


        BuildManager.DefaultBuildManager.BeginBuild(new BuildParameters(pc) { MaxNodeCount = Environment.ProcessorCount,Loggers = new List<ILogger>(){log} });
        BuildRequestData BuildRequest = new BuildRequestData(SolutionFile, GlobalProperty, null, new string[] { "Clean", "Rebuild" }, null);
        BuildSubmission Submission = BuildManager.DefaultBuildManager.PendBuildRequest(BuildRequest);

        Stopwatch watch = new Stopwatch();
        watch.Start();
        Submission.Execute();
        while (!Submission.IsCompleted)
        {
            if (isCancelled || watch.Elapsed==new TimeSpan(0,5,0))
            {
                e.Cancel = true;
            }
            worker.ReportProgress(0, "Building");
        }

        String output = String.Empty;
        System.IO.File.WriteAllText(LogFilePath, log.getLogoutput());

        BuildManager.DefaultBuildManager.EndBuild();
        e.Result = new Docs_Creator.Classes.Build.BuildSuccessArgs(
            SolutionName: SolutionFile,
            Success: Submission.BuildResult.OverallResult == BuildResultCode.Success,
            Error: null);
Matt Gordon
  • 168
  • 1
  • 9

0 Answers0