Tool: automatic generation of .saproj files

Uniwares_ASUniwares_AS Posts: 168
edited January 10, 2011 12:50PM in SmartAssembly 5
Hi all,
since I am working with SA often on larger solutions where some assemblies have references to 20 or more other assemblies, I also swear often enough about the way SA uses its project files.

Not much fun when you have to update a bunch of project files with references and settings, then do a build on the build server just to find out that some settings didn't work out, or some references are not found, etc.

So, to set an end to my personal dilemma, I looked for a solution and came up with one that will generate the .saproj file automatically on every build.

It basically works by using VS2010's Text Templating (T4) functionality combined with assembly level attributes.
You can define the SA settings for your assembly like this in your AssemblyInfo.cs file:
[assembly: SA.Obfuscation(FieldsNameMangling=2, NameMangling=2)]
[assembly: SA.ExceptionReporting(AlwaysContinueOnError=0, EmailToBeNotified="[email protected]", ReportExceptions=1, Template="res:{SmartExceptions}.NoUI.dll")]
[assembly: SA.OtherProtections(AddIncorrectMetadata=0, AddMetadataStream=1, SuppressIldasm=1 )]
[assembly: SA.StringsEncoding(Compress=1, Encode=1, UseCache=1, UseImprovedEncoding=1 )]
[assembly: SA.OtherOptimizations(ManageMemory=1, SealClasses=0 )]
[assembly: SA.Debugging(CreatePDB=1)]

Only needs to include a reference to a type-only assembly which defines the SA.* attributes

Before building, the .tt file recreates the .saproj file by reading project information from the current project, resolves assembly references, etc.

This is still work in progress and I am wanting to see if there is interest in a tool like that.

Current features are:
* automatic SA project creation
* detection of code signing and appropriate SA settings
* setting company and application names from the assemblyinfo
* setting SA options through attributes in the AssemblyInfo.cs
* resolution of all references and inclusion into project with full info and path, excluding system references
* a static reference include file (used for standard SA references but can accommodate others too)

Not supported (yet) is:
* exception lists for pruning and obfuscation
* C++ and web projects

I didn't test it yet with VB but it should work too.

If you need any advanced SA features you still can use the tool and modify the created project file by hand or load it into the SA GUI app.

Anyone interested?


Sign In or Register to comment.