MSBuild - Environment parameter not used


Badge +3

Hi,

 

We have four different environments, two of which we deploy straight from Visual Studio and two others (Qualification and Production) on which we deploy using the deployment package.

 

When we use the deployment package, we use msbuild 4.0 to deploy it and we add /p:Environment=value in the command.

 

We realized that this parameter is not taken into account by the .msbuild file. It always use the default value to deploy.

 

This command was working perfectly with 4.5 and doesn't seem to work anymore with 4.6

 

This means we need to manually change the default Environment value in the .msbuild file.

 

Thanking you in advance for a solution.

 

Regards,


13 replies

Badge +6

Hi Erwann,


 


Do you recieve any errors when trying to deploy via MSBuild?


 


Regards,


 


Yannick

Badge +3

Hi Yannick,

 

When creating a deployment package the default environment property is set to default value selected in Visual Studio.

Therefore we didn't have any errors because the default environment really exists.

We got to know the problem when I tried with "test" instead of the name of an environment in the default Environment property.

 

Lines in the .msbuild file for default values

 

<PropertyGroup>
  <TestOnly Condition="$(TestOnly) == ''">False</TestOnly>
  <Environment Condition="$(Environment) == ''">Prex</Environment>
</PropertyGroup>

 

Regards,

 

Badge +6

Hi Erwann,


 


I have tested this on my environment and it works on my side. I am currently using 4.6.7, I know you are using 4.6 but could tell me the exact version of Blackpearl you are currently running? Also which version of Visual Studio you are using?


 


Many Thanks,


 


Yannick 

Badge +3

Hi Yannick,

 

We have K2 blackpearl 4.6.6 (4.12020.1560.0) installed on all the environments. 

We use Visual Studio 2012 Update 3 to open the K2 solution and create the deploy package.

 

We tried both x86 and x64 versions of MSBuild 4.0.30319

 

Regards,

Badge +3

Yannick,

 

Attached you will find the trace of the error I get.

 

for the test I have these values in the MSBuild file : 

<PropertyGroup>
    <TestOnly Condition="$(TestOnly) == ''">False</TestOnly>
    <Environment Condition="$(Environment) == ''">test</Environment>
</PropertyGroup>

<PropertyGroup Condition="$(Environment) == 'Developpement'">

<PropertyGroup Condition="$(Environment) == 'Recette'">

<PropertyGroup Condition="$(Environment) == 'Prex'">

<PropertyGroup Condition="$(Environment) == 'Production'">

 

C:WindowsMicrosoft.NETFrameworkv4.0.30319>msbuild "c: empDeploymentWFBookTransfert.msbuild" /p:Environment=Developpement
or
C:WindowsMicrosoft.NETFrameworkv4.0.30319>msbuild "c: empDeploymentWFBookTransfert.msbuild" "/p:Environment=Developpement"

 

Regards,

Badge +8

How are you creating the deployment package? 

 

I've seen errors like that when trying to deploy, but usually it was because of errors during compilation of the package (even though the package was successfully created).

Badge +3

Hi,

 

In Visual Studio, I Right-click on the K2 project and then use "Create Deploy Package". 

 

When it's done I pick the folder called Deployment created in the objRelease folder.

 

Regards,

Badge +6

Hi Erwann,


 


Can you confirm for me if  the system path variable is set to specify the 4.0.net framework msbuild?  If not please specify it and try to deploy again.


 


Kind regards,


 


Yannick

Badge +3

Hi Yannick,

 

I tried without success your suggestion.

 

What I did : 

 

 - I added "C:WindowsMicrosoft.NetFrameworkV4.0.30319" to the path on the hosting server (where i use msbuild)

 - I added the same value on the server where I create the deployment package.

 

Regards,

 

Badge +6

Hi Erwann,


 


Please can you confirm for if all required files are present within the target environment? Please have a look at the link below and especially under the sub heading called "What is a Deploy Package?" 


 


http://help.k2.com/kb000188


 


Kind regards,


 


Yannick

Badge +3

Hi Yannick,

 

I was out of office for a while.

 

I'll have a look and come back to you.

 

Regards,

Badge +3

Hi Yannick,

 

I checked the link you put in your post and indeed we have the files required in the Deployment folder.

 

We use the command line method with /p:Environment=ourEnvironment


We don't put TestOnly but I can't think it would make a difference.

 

Any other suggestion will be welcomed.

 

Regards,

Badge +3

I had the same issue today.

 

When I ran MSBUILD 4.0 the environment parameter was ignored. I specified Development as the environment but it tried to deploy to Test (the default environment).

 

When I switched to MSBUILD 3.5 it respected the parameter and deployed to the correct environment. Not ideal but hope this helps.

Reply