Diff inbuild from Visual Studio / vs SmartAssembly interface
robbertdam
Posts: 7
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
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
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.
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.
When I include the .saproj in the Visual Studio as follows:
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.
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.
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?
Redgate Software