AutoCAD .NET Templates (ANT)
Why did it appear?
AutoCAD 2009 and newer versions are interesting for me. Therefore usually I compile the same code sources for AutoCAD 2009, 2013 and 2015. These assemblies can be loaded successfully in any AutoCAD newer than 2008. Thus it is necessary to create three projects in a solution. One of them has original code source files, other two projects has the links to these code source files. Three projects is not a problem. But I want to test my code, because quality my software is important for me. So, it is necessary to add three additional projects with unit tests.
But can I be 100% sure what my code will works fine in AutoCAD 2010, 2011, 2012, 2014 and 2016 without testing in these AutoCAD versions? No, I can't and nobody can't. Therefore it is necessary to create the testing projects for each AutoCAD newer than 2008. At this case my projects count is 3 + 8 = 11. Oh, it is big count... if it is required copy these projects to other computer, which has own locations of SDK (not the same like mine), then I must update all referenses of SDK manually. It is tiresome operation. Of course, as the decission of this problem it is possible to store local copies of the necessary DLL SDK files in each project: at this case your project will be portable [between computers].
I want to have two projects only [an extension and its unit tests] and compile it for all necessary AutoCAD versions through "a single click of mouse". I want to have opportunity of debugging [breackpoints, etc] my code in any AutoCAD version newer than 2008 and quickly switching between them. Also, compilation result must to have a "magic button" for my tests launching in each AutoCAD version [on the local or remote machine] and getting the testing results (summary and individually) in HTML format. Besides, I want to have opportunity to compile and launch unit tests without any changes for different Testing Frameworks: Gallio and NUnit.
AutoCAD .NET Templates was created for solving of these problems [through
msbuild.exe using in the batch files]. This is not a silver bullet. This is alternative approach to project structure for getting some benefits of batch building and testing. But with benefits this approach provides and some inconveniences also. In my opinion the benefits are more than inconveniences. Therefore I use it in my work. Read the Known problems and decisions in the ant.chm file for more detailed info.
This is not a silver bullet. This is alternative approach of project structure for getting some benefits of batch building and testing. But with benefits this approach provides and some inconveniences also. In my opinion benefits more than inconveniences. Therefore I use it in my work.
Warning (about NuGet using)
Don't use these templates if you want to use
NuGet packages in your project, because
NuGet doesn't update own files when
msbuild.exe temporarily changes the important properties of your project during the batch processing (.Net Framework version, and Target platform).
What is it?
This is the set of AutoCAD .NET Extension (and their Unit Tests) smart templates.
It has the documentation in the CHM-format:
Who This Is For?
This is for .net developers who write managed code for AutoCAD or AutoCAD verticals. Goal of this project is:
- Provide a flexible and simple capability of compiling the same project's code for several AutoCAD versions at once [batch building].
- Provide opportunity to create the Unit Tests for own extensions and compile the same its project's code for several AutoCAD versions at once also [batch building].
- Provide opportunity to create the portable projects: there is no need to update the references of such projects.
- Provide the simple capability to point a new target AutoCAD version for own code when it will appear.
- Provide the capability to load the same DLL into any AutoCAD version (newer than AutoCAD 2008).
Unit testing result sample
- Switching of the AutoCAD references and conditional compilation symbols.
- Package building of the managed extension.
- Switching for debugging of the various AutoCAD versions.
- Compilation the Unit Tests, their launching and viewing the results of testing.
You can download and freely use the AutoCAD .NET Templates.