Archives
-
Building Web Application Projects with CCNET
One of the things about Visual Studio 2005 I disapprove of the most is the way features related to your project are stuffed into the local devmachine environment under Program Files. Among other things the coming GAT (guidance automation toolkits) work this way, and so does the new bootstrapper packages. There are many drawbacks to this strategy, and they all become apparent when you decide to do distributed development against a common build environment.
So, when you're starting up with your Web Application Project (WAP) and install the MSI plugin for Visual Studio 2005 you pretty much know that this will break on the buildserver, or your fellow developers machine if the same MSI is not installed on that client. Most likely the other client (CCNET or another dev) will get a taste of this error:
error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Of course you could select the dictator strategy and enforce distributed installation of the WAP MSI installer, but I tend to prefer to keep my project completely packaged.
First copy the targets file to your solution directory and add it as a solution item so it is included in sourcecontrol. Then unload your WAP by right clicking in the Solution Explorer and then select "Edit MyWAP.csproj" to edit the MSBuild markup. Change this line:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" />
To this:
<Import Project="$(SolutionDir)\Microsoft.WebApplication.targets" />
Now save your csproj file and reload the project by right-clicking the unloaded project node in the solution explorer. This will give you a security warning (beware! you've edited your own build file) that you can safely ignore.
Now, Visual Studio automatically feeds MSBuild with the SolutionDir property so this will load in your IDE, but if you're going to call MSBuild from another tool, like NAnt, make sure you pass in a value for SolutionDir when executing msbuild.exe.
I know the WAP thing is reused across multiple projects and it is a good thing to have the templates in the "Microsoft Visual Studio 8" folder for easy access, but it does create a lot of work for us that want to keep our projects buildable in multimachine environments. -
More VSTO Deployment - AppCheck and PIACheck compiled
A while ago Microsoft released a walkthrough for VSTO deployment to, as Misha puts it; "not remove the pain but help controlling it". The walkthrough covers all my (less structured) instructions, and improves on security aspects.
However the article does provide you with a fair amount of work. The security part adds strong-name based evidence for assemblies which is absolutely required from a security perspective. However, the samples does not support multi-assembly deployments so you'll need to write this up yourself. I'll look into using Assembly.GetReferencedAssemblies() later on to see if that will solve this problem.
Furthermore you get native checking utils for common prereqs. These are not compiled however and Aerodrome has posted a compiled version. Although these exe's (PIACheck.exe and AppCheck.exe) works nicely if you've got the .NET Framework preinstalled, they will fail if not. Probably because they're compiled in managed C++, and not the way instructed in the MSDN article. We've made a working set available here (courtesy of compilation genious Øystein Garshol).
Finally I have to point out once more the weak design of the prerequisite package structure. The prerequisite definitions are fundamentally a part of any solution and should at least be copied into the solution or setup project filestructure when used to enable inclusion in sourcecontrol and automated builds. I would sure like to know how Microsoft approaches this problem using WiX or other tools.
And to all of you who haven't deleted my blog from your blogroll: I'm back:-)