如何使用C#

时间:2015-06-10 07:31:42

标签: reporting-services msbuild ssrs-2008 rdl

我想构建我的所有报告项目并将.rdl文件复制到其他位置。

我正在使用MSBuild.Engine。

 Engine engine = new Engine();

            // Point to the path that contains the .NET Framework 2.0 CLR and tools
            engine.BinPath = @"c:\windows\microsoft.net\framework\v2.0.50727";


            // Instantiate a new FileLogger to generate build log
            FileLogger logger = new FileLogger();

            // Set the logfile parameter to indicate the log destination
            logger.Parameters = @"logfile=C:\temp\build.log";

            // Register the logger with the engine
            engine.RegisterLogger(logger);

            // Build a project file 
            bool success = engine.BuildProjectFile(@"xyz.rptproj");

            //Unregister all loggers to close the log file
            engine.UnregisterAllLoggers();

            if (success)
                Console.WriteLine("Build succeeded.");
            else
                Console.WriteLine(@"Build failed. View C:\temp\build.log for details");

此外,我收到无法构建此项目的错误。 错误日志如下所示:

error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element.

有人可以帮忙或建议我吗?

由于

1 个答案:

答案 0 :(得分:0)

这可能不是最佳答案,但您可以在visual studio中创建一个空白类库项目,以进行构建和安装。将每个RDL文件添加到项目中,它们可以存在于另一个项目中,因此文件中的链接(.csproj中的文件路径)可以指向它们在源代码管理中的另一个项目上实际存在的位置。将每个文件标记为&#34; content&#34;并始终&#34;复制&#34;。之后保存并作为解决方案的一部分,您可以调用MSbuild来构建该项目并使用构建的内容输出,或者也可以在安装程序中使用它来使用项目的内容输出并指定您想要的位置安装文件夹生活。

相关问题