我正在尝试构建一个网站项目并使用MSBuild API发布到一个文件夹
using Microsoft.Build.Evaluation;
using Microsoft.Build.Execution;
using Microsoft.Build.BuildEngine;
var props = new Dictionary<string, string> {
{ "Configuration", "Release" },
{ "DeployOnBuild","true"},
{ "WebPublishMethod", "FileSystem"}
{ "PublishDir", "C:\Published\MySite\"},
{ "OutDir", "C:\Published\MySite\"},
};
var projPath = "C:\Projects\MySite.csproj";
var result = BuildManager.DefaultBuildManager.Build(
new BuildParameters { Loggers = new[] { new ConsoleLogger() } },
new BuildRequestData(new ProjectInstance(projPath, props, null), new[] { "Build" }));
if (result.OverallResult == BuildResultCode.Success)
{
Console.WriteLine("Succeeded!");
}
问题是它没有像我通过VisualStudio那样移动已发布的版本 - &gt;右击 - &gt;发布。
但目前它创建的内容如下面的结构,我不想要
"C:\Published\MySite\"
all bin content(*.dll)
_PublishedWebsite
ActualContent I Expected
Package (it has compressed version)
我所需要的只是构建&amp;将内容发布到文件夹“C:\ Published \ MySite \”
是否有人帮助我解决props
/个配置错误?