One or more entrIEs in the manifest
‘sitemanifest’ are not valID. The
library ‘<full path>\<assembly>’ Could
not be loaded. The given assembly name
or codebase was invalID. (Exception
from HRESulT: 0x80131047)
我认为它正在解释我作为装配名称的一部分提供的路径,这当然不是我的意思.
这有什么办法吗?是否可以将位于我本地目录中的程序集粘贴到Web Deploy程序包中以部署到服务器的GAC?
解决方法 Web Deploy 2.0有一个新的提供程序,可以满足您的要求:gacInstall提供程序(参见 http://technet.microsoft.com/en-us/library/gg607836(WS.10).aspx)允许嵌入在源程序包中的程序集在目标位置进行GAC.给出一个简单的清单:
<sitemanifest> <gacInstall path="C:\Temp\MyAssembly.dll" /></sitemanifest>
..你可以创建一个包含这样的程序集的包:
msdeploy -verb:sync -source:manifest="path to manifest.xml" -dest:package="path to package.zip"
..然后使用该软件包将其安装在远程计算机上的GAC中:
msdeploy -verb:sync -source:package="path the package.zip" -dest:auto,computername=REMOTEMACHINEname
(当然,如果组件有一个强大的名字!)
现在,相同的原理可以应用于VS Web项目.但是,您需要确保Web Deploy 2.x既安装在开发机器上,也安装在目标Web服务器上.而不是指定< MsDeploySourceManifest Include =“gacAssembly”>它必须是< MsDeploySourceManifest Include =“gacInstall”>.
这是一个完整的{projectname} .wpp.targets文件我试过这个(基于问题中提到的博客文章中的那个):
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <CreatePackageOnPublish>True</CreatePackageOnPublish> <IncludeGacAssemblyForMyProject>True</IncludeGacAssemblyForMyProject> <UseMsdeployExe>False</UseMsdeployExe> </PropertyGroup> <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> <AfterWriteItemsToSourceManifest> $(AfterWriteItemsToSourceManifest); _PrintSourceManifests; </AfterWriteItemsToSourceManifest> </PropertyGroup> <PropertyGroup> <IncludeGacAssemblyForMyProject Condition="'$(IncludeGacAssemblyForMyProject)'==''">False</IncludeGacAssemblyForMyProject> <AfteraddContentPathToSourceManifest Condition="'$(AfteraddContentPathToSourceManifest)'==''"> $(AfteraddContentPathToSourceManifest); CollectGacAssemblyForPackage; </AfteraddContentPathToSourceManifest> </PropertyGroup> <Target name="CollectGacAssemblyForPackage" DependsOnTargets="$(CollectGacAssemblyForPackageDependsOn)" Condition="$(IncludeGacAssemblyForMyProject)"> <ItemGroup> <MyGacAssembly Include="@(ReferencePath)" Condition="'%(ReferencePath.GacInstall)'=='true'" /> </ItemGroup> <Message Text="MsDeployPath: $(MSDeployPath)" /> <!-- For deBUGging --> <Message Text="Adding [gacInstall]: %(MyGacAssembly.IDentity)" /> <ItemGroup> <MsDeploySourceManifest Include="gacInstall" Condition="$(IncludeGacAssemblyForMyProject)"> <Path>%(MyGacAssembly.IDentity)</Path> </MsDeploySourceManifest> </ItemGroup> <CallTarget Targets="$(OnAfterCollectGacAssemblyForPackage)" RunEachTargetSeparately="false" /> </Target> <Target name="_PrintSourceManifests"> <!-- Just for deBUGging --> <Message Text="Exporting Manifests:" /> <Message Text=" @(MsDeploySourceManifest) : %(MsDeploySourceManifest.Path)" /> </Target></Project>
我添加的另一件事是如何选择gacInstall程序集,即通过元数据条目< GacInstall> True< / GacInstall>添加到相应的< Reference /> project.csproj文件中的标签:
<Reference Include="System.Data"> <GacInstall>True</GacInstall></Reference><Reference Include="MyAssembly,Version=1.0.0.0,Culture=neutral,PublicKeyToken=f430b784831ac64e,processorArchitecture=MSIL"> <HintPath>..\..\liB\MyAssembly.dll</HintPath> <GacInstall>True</GacInstall></Reference>
无论您是引用GAC程序集还是本地程序集,它都可以工作.
希望有帮助:)
总结以上是内存溢出为你收集整理的.net – Web Deploy可以为目标服务器的GAC打包本地程序集吗?全部内容,希望文章能够帮你解决.net – Web Deploy可以为目标服务器的GAC打包本地程序集吗?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)