Diff inbuild from Visual Studio / vs SmartAssembly interface

robbertdamrobbertdam Posts: 7
edited October 24, 2012 9:58AM in SmartAssembly
Hi all,

I have integrated the SmartAssembly obfuscation into my VS2012 project by following the instructions on the Red Gate website. However, I now run into the strange situation where the output of the build from Visual Studio is different from the output of the build from the SmartAssembly user interface.

The SmartAssembly task in Visual Studio gives the following errors:

SmartAssembly v6.7.0.239
10> Copyright © Red Gate Software 2005–2012
10> Loading project EasyFit.saproj
10> Loading...
10> Starting...
10> Analyzing...
10> Preparing...
10> Error rewriting xaml for resources/glowbutton.baml:
10> Object reference not set to an instance of an object.
10> Error rewriting xaml for windows/iprofilerimportwindow.baml:
10> Object reference not set to an instance of an object.
10> Error rewriting xaml for windows/nodatabaseconnectionwindow.baml:
10> Object reference not set to an instance of an object.
10> Error rewriting xaml for controls/lenspanel.baml:
10> Object reference not set to an instance of an object.

...and a lot more lines

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi,

    The last successful fix for this issue was to clean the build in VS and then rebuild all. It was something to do with a third-party control and code signing. Although I don't have specifics about why this solved the problem, it may be worth a try.
  • I tried to clean the build first, but the problem remains.

    Additional note: If I run obfuscation right from Visual Studio 2012, the resulting build crashes on startup. If I run obfuscation from outside Visual Studio, using the SmartAssembly user interface, the build is ok.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Crashes? Please explain...
  • I will try to be more clear:

    When I include the .saproj in the Visual Studio as follows:
    <Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release' ">
        <SmartAssembly.MSBuild.Tasks.Build ProjectFile="EasyFit.saproj" />
      </Target>
    

    And build my project, the resulting executable gives an unhandled exception at startup (see below for details of this exception).

    When I open this same .saproj in SmartAssembly and build, this exception does not occur when starting the resulting executable.

    The obfuscated executable is written in a seperate folder, which is a subdir of the bin\Release folder. Obfuscation and assembly merging is applied.

    It's an "System.Windows.Markup.XamlParseException" exception with the following message: "Cannot find type 'Type Name'. The assembly used when compiling might be different than that used when loading and the type is missing."

    It occurs in "XamlReader.LoadBaml". So the exception appears to be related to the error messages I see in MSBuild: "Error rewriting xaml for resources/glowbutton.baml"..etc.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    I'm mystified for two reasons - one, SmartAssembly is providing inadequate information to track down what the problem is, and two, why would it work through the UI and not the command line when it is using exactly the same code?

    Is it possible that the .saproj exists in two different locations, and one is an outdated .saproj? Possibly, specifying the full path to the project file in the build script would help rule that out.
  • Hi,
    I've checked the problem you describe with our development team and it sounds like something that may well be resolved in a patch build - could you try the patch available here and see if it fixes what you're seeing?
    Systems Software Engineer

    Redgate Software

Sign In or Register to comment.