使用NuGet将项目程序集引用添加到名为* .Resources.dll的文件中
发布时间:2020-12-14 02:01:13 所属栏目:Windows 来源:网络整理
导读:当确定应该将包中的哪些dll添加为程序集引用时,NuGet会排除任何结束“.Resources.dll”的内容.这旨在排除本地化的 satellite assemblies,但这意味着如果您有一个名为MyCompany.Resources.dll的DLL,则添加引用会很棘手. 这有什么好的解决方法吗? 解决方法 我
当确定应该将包中的哪些dll添加为程序集引用时,NuGet会排除任何结束“.Resources.dll”的内容.这旨在排除本地化的
satellite assemblies,但这意味着如果您有一个名为MyCompany.Resources.dll的DLL,则添加引用会很棘手.
这有什么好的解决方法吗? 解决方法
我现在通过在
https://nuget.codeplex.com/workitem/1644的一个例子进行了一些修改来解决这个问题.
我添加了对网站项目的检查,因为它们不支持“添加”方法. 我在我的nuspec文件中的元数据元素之后添加了这个. (如果你没有使用NuGet 2.5中提供的includereferencedprojects选项,可能只有必要) <files> <file src="binReleaseFoo.Resources.dll" target="libnet40" /> <file src="binReleaseFoo.Resources.pdb" target="libnet40" /> <file src="tools*" target="tools" /> </files> 然后将这两个文件添加到项目目录中的新工具文件夹中. (注意修复DLL路径传递给References.Add方法的方式,与codeplex示例相比) Install.ps1 param($installPath,$toolsPath,$package,$project) $resourcesDll = Join-Path $installPath "libnet40Foo.Resources.dll" Write-Host "Adding resources DLL from " $resourcesDll if ($project.Kind -eq "{E24C65DC-7377-472b-9ABA-BC803B73C61A}") { $project.Object.References.AddFromFile($resourcesDll) } else { $project.Object.References.Add($resourcesDll) } Uninstall.ps1 param($installPath,$project) Write-Host "Removing Foo.Resources reference" $project.Object.References | where { $_.Name -eq 'Foo.Resources' } | foreach { $_.Remove() } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows – cygwin console2:运行cygwin bash与启动目录
- Windows AD域通过组策略设置域用户登录和注销脚本
- the specified service is marked as deletion,can not fin
- 获取与Windows Vista上的C#.Net连接的无线网络的SSID
- windows – 如何禁用Qt QMessageBox播放的声音?
- Windows Phone 7通知/流行/祝酒词
- 在DataGridView控件中验证数据输入
- 如何从Windows锁定Windows(如“Windows L”)?
- Windows Azure网站状态有限公司[已关闭]
- windows – 如何针对流行的病毒扫描程序测试我的应用程序?