Search code examples
azurevisual-studio-2012.net-4.5slowcheetah

SlowCheetah working in VS but not from command line


I have an Azure cloud service, with a web role and a worker.

I have a problem with the worker role when I create the Package from the command line. My worker is a simple class Library with a App.Config and transformation are made with SlowCheetah 2.5.5.

If I right click on my Azure Cloud Service and Package it everything is fine, the app.config in the end will be the one transformed by SlowCheetah as you can see below

22>Target "CopyWorkerRoleFiles" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets" from project "C:\dev\My\WindowsAzure\WindowsAzure.ccproj" (target "CopyRoleFiles" depends on it):
22> WorkerFiles=C:\dev\My\MyWorker\bin\QA\MyWorker.dll.config -> MyWorker.dll.config
22> WorkerFiles=C:\dev\My\MyWorker\obj\QA\MyWorker.dll -> MyWorker.dll
22> WorkerFiles=C:\dev\My\MyWorker\obj\QA\MyWorker.pdb -> MyWorker.pdb
22> WorkerFiles=C:\dev\My\MyWorker\obj\QA\SlowCheetah\App.config -> MyWorker.dll.config

From command line, now, when I create the package, SlowCheetah is not used anymore and I don't have the transformation

CopyWorkerRoleFiles:
WorkerFiles=C:\CI\My\MyWorker\bin\QA\MyWorker.dll.config -> MyWorker.dll.config
WorkerFiles=C:\CI\My\MyWorker\bin\QA\App.config -> App.config
WorkerFiles=C:\CI\My\MyWorker\obj\QA\MyWorker.dll -> MyWorker.dll
WorkerFiles=C:\CI\My\MyWorker\obj\QA\MyWorker.pdb -> MyWorker.pdb

How can I find what I am missing to have the same behavior between VS and the command line?

EDIT:

I have created a small cloud project with one worker role and slowcheetah, and everything is working fine on this new project... The problem is coming from my project, I have doubled check the csproj and ccproj from my solution with the ones from the test solution and I don't see any big difference...

EDIT 2:

Here is my msbuild command to compile my project

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe .\MyProject.sln 
/p:Configuration=QA /p:TargetProfile=CloudQA /target:Publish /nr:false

EDIT 3: I finally narrowed the problem to this, I have updated Microsoft.Bcl to 1.1.3, I compiled it, the transformation works fine!

I have updated Microsoft.Net.Http to 2.2.13, I compiled it, the transformation failed.

The nuget packages added this to my csproj...

      <Reference Include="System.Net.Http" />
 +    <Reference Include="System.Net.Http.Extensions">
 +      <HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\net45\System.Net.Http.Extensions.dll</HintPath>
 +    </Reference>
      <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
        <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
      </Reference>
 +    <Reference Include="System.Net.Http.Primitives">
 +      <HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\net45\System.Net.Http.Primitives.dll</HintPath>
 +    </Reference>
 +    <Reference Include="System.Net.Http.WebRequest" />

If I remove all the references the transformation is working again...

I added back this reference and the transformation was still working:

 +    <Reference Include="System.Net.Http.WebRequest" />

I added this references one by one

 +    <Reference Include="System.Net.Http.Extensions">
 +      <HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\net45\System.Net.Http.Extensions.dll</HintPath>
 +    </Reference>
 +    <Reference Include="System.Net.Http.Primitives">
 +      <HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\net45\System.Net.Http.Primitives.dll</HintPath>
 +    </Reference>

And the project transformation failed again.

EDIT 4:

More information on this problem, Micorosoft.Net.HttpClient Nuget Packages is also modifying the app.config when System.Net.Http.Extensions and System.Net.Http.Primitives. It adds the following to app.config

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
<assemblyIdentity name="System.Net.Http.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.13.0" newVersion="2.2.13.0" />
    </dependentAssembly>
    <dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.13.0" newVersion="4.2.13.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

Here is the build output with these assemblies referenced

17>_CopyAppConfigFile:
17>  Copying file from "obj\Debug\Tests.MyProject.Data.csproj.App.config" to "bin\Debug\Tests.MyProject.Data.dll.config".
17>CopyFilesToOutputDirectory:
17>  Copying file from "obj\Debug\Tests.MyProject.Data.dll" to "bin\Debug\Tests.MyProject.Data.dll".
17>  Tests.MyProject.Data -> C:\dev\MyProject\Tests\Tests.MyProject.Data\bin\Debug\Tests.MyProject.Data.dll
17>  Copying file from "obj\Debug\Tests.MyProject.Data.pdb" to "bin\Debug\Tests.MyProject.Data.pdb".
17>ScReplaceAppConfigItem:
17>  Updated app.config to point to transformed file
17>      AppConfigWithTargetPath: obj\Debug\Tests.MyProject.Data.csproj.App.config
17>      AppConfigWithTargetPath.TargetPath: Tests.MyProject.Data.dll.config

Removing the Microsoft references

17>_CopyAppConfigFile:
17>  Copying file from "App.config" to "bin\Debug\Tests.MyProject.Data.dll.config".
17>CopyFilesToOutputDirectory:
17>  Copying file from "obj\Debug\Tests.MyProject.Data.dll" to "bin\Debug\Tests.MyProject.Data.dll".
17>  Tests.MyProject.Data -> C:\dev\MyProject\Tests\Tests.MyProject.Data\bin\Debug\Tests.MyProject.Data.dll
17>  Copying file from "obj\Debug\Tests.MyProject.Data.pdb" to "bin\Debug\Tests.MyProject.Data.pdb".
17>ScReplaceAppConfigItem:
17>  Copying file from "bin\Debug\Tests.MyProject.Data.dll.config" to "obj\Debug\SlowCheetah\App.config".
17>  Updated app.config to point to transformed file
17>      AppConfigWithTargetPath: obj\Debug\SlowCheetah\App.config
17>      AppConfigWithTargetPath.TargetPath: Tests.MyProject.Data.dll.config

Solution

  • Problem solved with Slowcheetah 2.5.7