If we want to package and deploy GACed dll, we need to use gacAssembly web deploy provider and extend our project similarly to the one stated in the how to package registry blog. The extended projectName.wpp.targets file looks like following:
<!--********************************************************************--> <!-- Task CollectGacAssemblyForPackage –> <!-- GacAssembly reference: http://technet.microsoft.com/en-us/library/dd569056(WS.10).aspx --> <!--********************************************************************--> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <!--Targets get execute before this Target--> <OnBeforeCollectGacAssemblyForPackage Condition="'$(OnBeforeCollectGacAssemblyForPackage)'==''"> </OnBeforeCollectGacAssemblyForPackage> <!--Targets get execute after this Target--> <OnAfterCollectGacAssemblyForPackage Condition="'$(OnAfterCollectGacAssemblyForPackage)'==''"> </OnAfterCollectGacAssemblyForPackage> <CollectGacAssemblyForPackageDependsOn Condition="'$(CollectGacAssemblyForPackageDependsOn)'==''"> $(OnBeforeCollectGacAssemblyForPackage); Build; </CollectGacAssemblyForPackageDependsOn> </PropertyGroup> <PropertyGroup> <IncludeGacAssemblyForMyProject Condition="'$(IncludeGacAssemblyForMyProject)'==''">False</IncludeGacAssemblyForMyProject> <MyGacAssemblies Condition="'$(MyGacAssemblies)'==''"></MyGacAssemblies> <AfterAddContentPathToSourceManifest Condition="'$(AfterAddContentPathToSourceManifest)'==''"> $(AfterAddContentPathToSourceManifest); CollectGacAssemblyForPackage; </AfterAddContentPathToSourceManifest> </PropertyGroup> <ItemGroup> <MyGacAssembly Include = "$(MyGacAssemblies)"/> </ItemGroup> <Target Name="CollectGacAssemblyForPackage" DependsOnTargets="$(CollectGacAssemblyForPackageDependsOn)" Condition="$(IncludeGacAssemblyForMyProject) AND '$(MyGacAssemblies)'!=''"> <Message Text="Adding %(MyGacAssembly.Identity)" /> <ItemGroup> <MsDeploySourceManifest Include="gacAssembly" Condition="$(IncludeGacAssemblyForMyProject)"> <Path>%(MyGacAssembly.Identity)</Path> </MsDeploySourceManifest> </ItemGroup> <CallTarget Targets="$(OnAfterCollectGacAssemblyForPackage)" RunEachTargetSeparately="false" /> </Target> </Project>
Then you can use the following command line to package the project with corresponding Mvc GACs and 4.0 version of System.Web.Routing and System.Web.Abstractions.
msbuild WebApplication2.csproj /target:package /p:IncludeGacAssemblyForMyProject=True;MyGacAssemblies="System.Web.Mvc;System.Web.Routing,Version=4.0.0.0;System.Web.Abstractions,Version=4.0.0.0"
Note, gacAssembly web deploy provider has some limitation as described in the link.
Xinyang Qiu | Visual Web Developer
0 comments