How To Build Release
Gao996 opened this issue · 4 comments
Gao996 commented
It seems that all builds are debug versions, how to do something like this
dotnet msbuild /p:Configuration=Release
Generate release version
Forgind commented
dotnet msbuild --configuration Release
worked for me.
Gao996 commented
What if you use code
public void MethodThatDoesNotDirectlyCallMSBuild()
{
MSBuildLocator.RegisterDefaults();
Build();
}
private static void Build()
{
var p = new BuildParameters
{
MaxNodeCount = 4,
Loggers = new ILogger[] { new Microsoft.Build.Logging.ConsoleLogger(LoggerVerbosity.Normal) },
};
var req = new BuildRequestData(BuildPath,
new Dictionary<string, string>(),
null,
new[] { "Build" },
null,
BuildRequestDataFlags.None);
var result = BuildManager.DefaultBuildManager.Build(p, req);
if (result.OverallResult.Equals(BuildResultCode.Failure))
{
throw new System.Exception();
}
}
Gao996 commented
If setting the parameters like this will generate an empty Release folder, the build will still fail
var req = new BuildRequestData(BuildPath,
new Dictionary<string, string>() { { "configuration","Release"} },
null,
new[] { "Build" },
null,
BuildRequestDataFlags.None);
Gao996 commented
When I use vs to generate once, these seem to work well, is the last successful version automatically generated?