c# - 删除 xaml 文件中未使用的引用程序集

标签 c# xaml workflow-foundation-4

当我在代码 View 中打开我的 Windows 工作流文件 (.xaml) 时,我看到了这个巨大的引用程序集列表

<TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Antlr3.Runtime</AssemblyReference>
      <AssemblyReference>AutoMapper</AssemblyReference>
      <AssemblyReference>dk.nita.saml20</AssemblyReference>
      <AssemblyReference>DocumentFormat.OpenXml</AssemblyReference>
      <AssemblyReference>EntityFramework</AssemblyReference>
      <AssemblyReference>EntityFramework.Extended</AssemblyReference>
      <AssemblyReference>EntityFramework.SqlServer</AssemblyReference>
      <AssemblyReference>log4net</AssemblyReference>
      <AssemblyReference>Microsoft.CSharp</AssemblyReference>
      <AssemblyReference>Microsoft.Exchange.WebServices</AssemblyReference>
      <AssemblyReference>Microsoft.Exchange.WebServices.Auth</AssemblyReference>
      <AssemblyReference>Newtonsoft.Json</AssemblyReference>
      <AssemblyReference>Ninject</AssemblyReference>
      <AssemblyReference>Ninject.Web.Common</AssemblyReference>
      <AssemblyReference>Ninject.Web.Mvc</AssemblyReference>
      <AssemblyReference>PresentationCore</AssemblyReference>
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Activities.Presentation</AssemblyReference>
      <AssemblyReference>System.IdentityModel</AssemblyReference>
      <AssemblyReference>System.IdentityModel.Services</AssemblyReference>
      <AssemblyReference>System.Net.Http</AssemblyReference>
      <AssemblyReference>System.Net.Http.Formatting</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.Security</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Web.DynamicData</AssemblyReference>
      <AssemblyReference>System.Web.Entity</AssemblyReference>
      <AssemblyReference>System.Web.ApplicationServices</AssemblyReference>
      <AssemblyReference>System.ComponentModel.DataAnnotations</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>
      <AssemblyReference>System.Web.Extensions</AssemblyReference>
      <AssemblyReference>System.Web.Helpers</AssemblyReference>
      <AssemblyReference>System.Web.Http</AssemblyReference>
      <AssemblyReference>System.Web.Http.Tracing</AssemblyReference>
      <AssemblyReference>System.Web.Http.WebHost</AssemblyReference>
      <AssemblyReference>System.Web.Mvc</AssemblyReference>
      <AssemblyReference>System.Web.Optimization</AssemblyReference>
      <AssemblyReference>System.Web.Razor</AssemblyReference>
      <AssemblyReference>System.Web.WebPages</AssemblyReference>
      <AssemblyReference>System.Web.WebPages.Deployment</AssemblyReference>
      <AssemblyReference>System.Web.WebPages.Razor</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>System.Drawing</AssemblyReference>
      <AssemblyReference>System.Web</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Configuration</AssemblyReference>
      <AssemblyReference>System.Web.Services</AssemblyReference>
      <AssemblyReference>System.EnterpriseServices</AssemblyReference>
      <AssemblyReference>TuesPechkin</AssemblyReference>
      <AssemblyReference>WebActivatorEx</AssemblyReference>
      <AssemblyReference>WebGrease</AssemblyReference>
      <AssemblyReference>WindowsBase</AssemblyReference>
      <AssemblyReference>Microsoft.Web.Infrastructure</AssemblyReference>
      <AssemblyReference>MyProject.Lib</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>MyProject.Web</AssemblyReference>
    </sco:Collection>

我 99% 确定其中的大部分不会在工作流程中使用。但是,如果我想对此流程运行单元测试,我需要引用所有这些程序集。似乎有很多不必要的引用。我可以避免这种情况吗?

最佳答案

如果工作流中的事件正在使用这些引用,那么此工作流也将需要它。没有办法解决这个问题。

理论上,您可以一个一个地删除引用并尝试运行工作流程。不幸的是,这会很乏味。

像 ReSharper 这样的实用程序可能有一种自动清理未使用的引用的方法...

关于c# - 删除 xaml 文件中未使用的引用程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45438198/

相关文章:

workflow-foundation-4 - 如何在 WF 4 中执行异步事件时控制线程数

c# - C#发布的程序.exe和dll,在启动时可以在我的计算机上运行,​​但不能在其他计算机上运行

c# - 多行插入的 IDBCommand 参数

c# - 如何根据日期创建文件?

c# - 将自定义工具提示添加到 DataGrid 中的行

c# - 如何在 Windows Phone 上优化带有图像的长列表选择器的性能?

c# - Windows Workflow 是否适合非编程最终用户?

c# - 从 MEF 容器中移除

xaml - 在 Windows 8 中移动和调整 Canvas 内的矩形

build-automation - 无法在自定义构建过程模板中删除 TFS2010 的自定义工作流事件