Project.Build does not work with DeployOnBuild=true

485 Views Asked by At

My code is as follows:

...

propertyGroup1.AddProperty("DeployOnBuild", "true");
propertyGroup1.AddProperty("DeployTarget", "MSDeployPublish");
propertyGroup1.AddProperty("MSDeployServiceUrl", "localhost");
propertyGroup1.AddProperty("DeployIisAppPath", "local.projects.com");
propertyGroup1.AddProperty("MSDeployPublishMethod", "InProc");
propertyGroup1.AddProperty("AllowUntrustedCertificate", "true");

...

cSharpProject.ProjectCollection.RegisterLogger(cSharpLogger);
try {
      buildResult = cSharpProject.Build();
...

buildResult is set to false. However, it does not raise any error to the logger. And the project is not deployed.

I'm running my exe in Administrator mode.

Any help is apprecited.

Thanks

Chris hint: CSAutoParameterize.parameters and other subfolders have not been created.

1

There are 1 best solutions below

0
On BEST ANSWER
      <Target Name="WebPublish">
    <MsBuild Projects="MyProject.csproj" Properties="DeployOnBuild=true;DeployTarget=MSDeployPublish;MSDeployServiceUrl=localhost;DeployIisAppPath=local.website.com;MSDeployPublishMethod=RemoteAgent;AllowUntrustedCertificate=true;Username=someuser;password=somepassword" />
  </Target>

I was able to add this target to the project and call just that specific target.