Commits

David Fowler committed 65811f5

Throw base exception when something fails to the exception is clear.
Updated nuget exe and packed from project.

Comments (0)

Files changed (9)

.nuget/NuGet.exe

Binary file added.

.nuget/NuGet.settings.targets

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup>
+        <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
+        <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
+        <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
+        <PackagesConfig>$(ProjectDir)packages.config</PackagesConfig>
+        <PackagesDir>$(SolutionDir)packages</PackagesDir>
+        <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
+
+        <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
+        <PackageSources>""</PackageSources>
+
+        <!-- Enable the restore command to run before builds -->
+        <RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
+
+        <!-- Property that enables building a package from a project -->
+        <BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
+
+        <!-- Commands -->
+        <RestoreCommand>"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
+        <BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)"</BuildCommand>
+
+        <!-- Make the build depend on restore packages -->
+        <BuildDependsOn Condition="$(RestorePackages) == 'true'">
+            RestorePackages;
+            $(BuildDependsOn);
+        </BuildDependsOn>
+
+        <!-- Make the build depend on restore packages -->
+        <BuildDependsOn Condition="$(BuildPackage) == 'true'">
+            $(BuildDependsOn);
+            BuildPackage;
+        </BuildDependsOn>
+    </PropertyGroup>
+    
+    <Target Name="CheckPrerequisites">
+        <!-- Raise an error if we're unable to locate nuget.exe  -->
+        <Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
+    </Target>
+</Project>

.nuget/NuGet.targets

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <Import Project="NuGet.settings.targets"/>
+    
+    <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
+        <Exec Command="$(RestoreCommand)"
+              LogStandardErrorAsError="true"
+              Condition="Exists('$(PackagesConfig)')" />
+    </Target>
+
+    <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
+        <Exec Command="$(BuildCommand)"
+              LogStandardErrorAsError="true" />
+    </Target>
+</Project>

Tools/NuGet.exe

Binary file removed.

WebActivator/ActivationManager.cs

         private static void RunActivationMethods<T>() where T : BaseActivationMethodAttribute {
             foreach (var assembly in Assemblies.Concat(AppCodeAssemblies)) {
                 foreach (BaseActivationMethodAttribute activationAttrib in assembly.GetActivationAttributes<T>()) {
-                    activationAttrib.InvokeMethod();
+                    try {
+                        activationAttrib.InvokeMethod();
+                    }
+                    catch (TargetInvocationException ex) {
+                        // Throw the relevant exception
+                        throw ex.GetBaseException();
+                    }
                 }
             }
         }

WebActivator/Properties/AssemblyInfo.cs

 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.4.1.0")]
+[assembly: AssemblyVersion("1.4.2.0")]
 
 [assembly: PreApplicationStartMethod(typeof(WebActivator.ActivationManager), "Run")]

WebActivator/Properties/WebActivator.nuspec

+<?xml version="1.0"?>
+<package>
+  <metadata>
+    <id>$id$</id>
+    <version>$version$</version>
+    <authors>$author$</authors>
+    <requireLicenseAcceptance>false</requireLicenseAcceptance>
+    <description>$description$</description>
+    <licenseUrl>http://www.opensource.org/licenses/ms-pl</licenseUrl>
+    <projectUrl>https://bitbucket.org/davidebbo/webactivator</projectUrl>
+  </metadata>
+</package>

WebActivator/WebActivator.csproj

     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <TargetFrameworkProfile />
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+    <BuildPackage>true</BuildPackage>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="WebActivator.nuspec">
+    <None Include="Properties\WebActivator.nuspec">
       <SubType>Designer</SubType>
     </None>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Target Name="AfterBuild">
-    <Exec Command="..\tools\nuget.exe pack $(AssemblyName).nuspec -o $(OutputPath) -v" WorkingDirectory="$(MSBuildProjectDirectory)" />
-  </Target>
+  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">

WebActivator/WebActivator.nuspec

-<?xml version="1.0"?>
-<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-  <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
-    <id>WebActivator</id>
-    <version>1.4.1</version>
-    <authors>David Ebbo</authors>
-    <owners>David Ebbo</owners>
-    <requireLicenseAcceptance>false</requireLicenseAcceptance>
-    <description>A NuGet package that allows other packages to execute some startup code in web apps</description>
-    <licenseUrl>http://www.opensource.org/licenses/ms-pl</licenseUrl>
-    <projectUrl>https://bitbucket.org/davidebbo/webactivator</projectUrl>
-  </metadata>
-</package>