Build Manager许可组件

时间:2014-05-13 15:47:37

标签: c# .net build msbuild buildmanager

下午好。

构建包含我正在使用的第三方氪组件的.licx文件的项目时,我遇到了BuildManager类的问题。

我的编译器是用.Net 4.5编写的,而目标构建项目是.Net 2.0。

尝试通过构建管理器构建时,目标项目会生成以下消息。

无法解析类型' ComponentFactory.Krypton.Navigator.KryptonNavigator,ComponentFactory.Krypton.Navigator,Version = 2.6.1.0,Culture = neutral,PublicKeyToken = [License]

它从视觉工作室构建良好,我已将组件放入.Net 4.5应用程序,并且还构建,所以我假设该问题与.Net 2上的组件发生冲突。我无法升级此项目

我希望它只是构建管理器所需的属性,但我找不到很多文档。

这是我的构建代码

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);

0 个答案:

没有答案