SA MSbuild task errors out during Teambuild

SjohnSjohn Posts: 2
edited August 6, 2013 8:19PM in SmartAssembly
Hello, I'm using SmartAssembly 6.8.
My workflow involves a solution that builds 6 other .dll files before building an .exe file project at the end.
It is that .exe file which is obfuscated, has the .dll files obfuscated + merged, or embedded.
When running a local build from VS2010, (either via Build->Build Solution or Right clicking on the .exe project and publishing using ClickOnce,) I am able to create and obfuscate my the .exe successfully during the "AfterCompile" target containing the SmartAssembly.MSBuild.Tasks.Build command.

However, when attempting to build the project via Teambuild, I receive the following error:
...Unhandled Exception: Microsoft.Build.Shared.InternalErrorException: MSB0001: Internal MSBuild Error: Attempted to use an inactive task host.
 at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage)
 at Microsoft.Build.BackEnd.TaskHost.LogMessageEvent(BuildMessageEventArgs e)
 at Microsoft.Build.Utilities.TaskLoggingHelper.LogMessage(MessageImportance importance, String message, Object[] messageArgs)
 at System.IO.TextWriter.SyncTextWriter.WriteLine(String value)
 at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)
 at Microsoft.Build.CommandLine.MSBuildApp.Main()
 TF270015: 'MSBuild.exe' returned an unexpected exit code. Expected '0'; actual '255'.
Digging further into the log, this is what it says:
  Copying file from "Config\Test\app.config" to "C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Binaries\Test\TimeBloxGUI.exe.config".
  Copying file from "obj\Test\TimeBloxGUI.exe.manifest" to "C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Binaries\Test\TimeBloxGUI.exe.manifest".
  TimeBloxGUI -> C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Binaries\Test\TimeBloxGUI.exe.manifest
  Copying file from "obj\Test\TimeBloxGUI.application" to "C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Binaries\Test\TimeBloxGUI.application".
  TimeBloxGUI -> C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Binaries\Test\TimeBloxGUI.application
  Copying file from "obj\Test\TimeBloxGUI.exe" to "C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Binaries\Test\TimeBloxGUI.exe".
  TimeBloxGUI -> C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Binaries\Test\TimeBloxGUI.exe
  Copying file from "obj\Test\TimeBloxGUI.pdb" to "C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Binaries\Test\TimeBloxGUI.pdb".
  SmartAssembly v6.8.0.121
  Copyright © Red Gate Software 2005–2013
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj(521,5): error : SmartAssembly build failed:
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj(521,5): error : The type initializer for '.' threw an exception.
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning : The type initializer for '.' threw an exception.
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning :    at Œ.€.()
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning :    at ...ctor(String ,  )
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning :    at ...ctor(String , Boolean ,  )
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning :    at Œ.€.( , Boolean , String )
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning :    at Œ.€.(String )
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning :    at SmartAssembly.ConsoleApp.CommandLineAction(String ,  , Dictionary`2 )
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning :    at SmartAssembly.ConsoleApp.Run(String[] , Boolean )
C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj : warning :    at SmartAssembly.ConsoleApp.Run(String[] )
Done Building Project "C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI\TimeBloxGUI.csproj" (default targets) -- FAILED.
Done Building Project "C:\MSVS\CTMS\Obfuscated TimeBloxGUI\Sources\TimeBloxGUI.sln" (default targets) -- FAILED.

I don't know why this occurs.
Additionally, I can get it to "build" and obfuscate successfully from a team build using the "AfterBuild" target and the exec command=, however this causes issues with our post-build scripts...effectively breaking our workflow.
My .saproj file is looking for the dependency paths using the following structure:
with Test being that configuration (there are 3, and each has its own .saproj and files for that version). So I know that everything should be in the proper place & visible...

Does anyone know why the SA MSbuild task would be able to obfuscate successfully during a localbuild/ClickOnce Publish (locally), but generate the described errors during a Team Build?


  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Thanks for your post! I'm afraid I'm not immediately sure what could be wrong. It's possible this is another issue with having multiple log4net versions in the VS environment (as the issue here: ... hp?t=15925 )

    But if this is not the case, could you please try a team build with all SmartAssembly options turned off for your assembly and see if the failed build persists?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Sign In or Register to comment.