标签: assemblies

确定程序集是否是.NET框架的一部分

如何从程序集名称或程序集类(或其他类似程序)判断程序集是否是.NET框架的一部分(即System.windows.Forms)?

到目前为止,我已经考虑了PublicKeyToken和CodeBase属性,但这些对于整个框架并不总是相同.

我想要这些信息的原因是为了获取我的EXE文件正在使用的程序集列表,这些程序集需要在客户端计算机上,因此我可以在安装文件中打包正确的文件,而无需使用Visual Studio安装系统.问题是,我不想拿起任何.NET框架程序集,我希望它是一个自动过程,很容易在主要更新完成后推出.

最终的解决方案是有一个IsFramework属性...... :)

.net reflection frameworks assemblies

16
推荐指数
3
解决办法
2779
查看次数

16
推荐指数
1
解决办法
3万
查看次数

如何在Windows Server 2008中的程序集中安装文件?

通常我以前做的是将文件拖放到GAC文件夹中.
这适用于Windows 2000和2003,但是当我尝试在Windows Server 2008中执行此操作时,我得到"访问被拒绝".

执行此操作的用户是本地管理员.

我能找到的唯一参考是: 论坛链接

还有另一种方法来实现这一目标吗?

注意:我尝试以管理员身份运行资源管理器,但是我收到同样的错误.

编辑:理想情况下,无论什么解决方案都不应该关闭UAC,或安装任何软件开发工具包.(因此它可以应用于生产服务器).

编辑:有没有人对此有任何想法?我目前已经开始禁用开发中的UAC,但这在现场是不可接受的.

.net assemblies windows-server-2008

16
推荐指数
1
解决办法
5万
查看次数

Maven-assembly-plugin:自定义jar文件名

我使用程序集插件创建了几个包含一些类的jar.我需要生成的罐子的自定义名称:app_business.jar app_gui.jar core.jar等.

目前我必须遵循以下配置:

    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <appendAssemblyId>false</appendAssemblyId>
    <finalName>app_business</finalName>
        <descriptors>
            <descriptor>assembly.xml</descriptor>
        </descriptors>
        <attach>true</attach>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

一个assembly.xml文件:

    <assembly>
      <id>app_business</id>
      <formats>
        <format>jar</format>
      </formats>
      <baseDirectory>target</baseDirectory>
      <includeBaseDirectory>false</includeBaseDirectory>

      <fileSets>
        <fileSet>
          <directory>${project.build.outputDirectory}</directory>
          <outputDirectory></outputDirectory> 
          <includes>
            <include>org/xyz/**</include>
          </includes>
        </fileSet>    
      </fileSets>
    </assembly>
Run Code Online (Sandbox Code Playgroud)

这会创建一个完美的文件app_business.jar.但我不知道如何创建我的其他文件.选项appendAssemblyId对我没有帮助,因为它以AppName-app_business.jar格式创建文件名.我真的需要确切的文件名app_business.jar.

任何的想法?非常感谢你!

maven-2 assemblies jar

16
推荐指数
2
解决办法
2万
查看次数

C# - 引用动态生成的程序集中的类型

我试图弄清楚当你动态生成程序集时,是否有可能引用先前动态生成的程序集中的类型.

例如:

using System;
using System.CodeDom.Compiler;
using System.Reflection;
using Microsoft.CSharp;

CodeDomProvider provider = new CSharpCodeProvider();
CompilerParameters parameters = new CompilerParameters();

parameters.GenerateInMemory = true;

CompilerResults results = provider.CompileAssemblyFromSource(parameters, @"
namespace Dynamic
{
    public class A
    {
    }
}
");

Assembly assem = results.CompiledAssembly;

CodeDomProvider provider2 = new CSharpCodeProvider();
CompilerParameters parameters2 = new CompilerParameters();

parameters2.ReferencedAssemblies.Add(assem.FullName);
parameters2.GenerateInMemory = true;

CompilerResults results2 = provider2.CompileAssemblyFromSource(parameters2, @"
namespace Dynamic
{
    public class B : A
    {
    }
}
");

if (results2.Errors.HasErrors)
{
    foreach (CompilerError error in …
Run Code Online (Sandbox Code Playgroud)

c# assemblies reference dynamic

16
推荐指数
1
解决办法
7546
查看次数

为什么我的Xamarin PCL在为Universal App构建版本时会抛出运行时异常?

我有一个xamarin PCL,可以在x86调试模式下构建.当我将其切换到发布模式(x86或x64)或x64调试时,我得到运行时异常.它可能与...有关

https://forums.xamarin.com/discussion/57810/issue-with-xamarin-forms-in-windows-uwp-app-compiled-in-the-release-mode

但我不知道我正在使用的其他组件.我该怎么说?

我的电脑是x64.当我在调试或发布中运行x64时,我得到了

MyApp.Interop.dll中的"System.NotImplementedException"异常.附加信息Arg_NotImplementedException.

在进入构造函数App()之前.对构造函数的调用如下:

LoadApplication(new MyApp.App());
Run Code Online (Sandbox Code Playgroud)

当我构建x86时,我会更进一步.它进入MyAppConstructor并调用xaml构造函数并给出异常:

System.Private.Reflection.Core.dll AdditionalInfo中的System.Reflection.MissingMetadataException:Arg_InvokeMethodMissingMetadata,System.EventHandler.有关详细信息,请访问http://go.microsoft.com/fwlink/?LinkId=623485

所以它看起来像我缺少的Xaml程序集.如何找出我需要添加的程序集?

我把它放回Debug,但把它转为"使用Native Compiler",这样我就可以获得有关异常的更多细节:

x86:附加信息:无法在类型"System.EventHandler"上创建委托,因为它缺少Invoke方法的元数据.有关详细信息,请访问http://go.microsoft.com/fwlink/?LinkID=616867

x64:Xamarin.Forms.Platform.UAP.dll中出现"System.NotImplementedException"类型的异常,但未在用户代码中处理

附加信息:未实现方法或操作.

更新:我猜Xamain不支持x64,因为没有移动产品有x64处理器?仍然留下了x86版本的问题.我尝试在Universal App.xaml.cs中添加以下程序集

  List<Assembly> assembliesToInclude = new List<Assembly>();
  assembliesToInclude.Add(typeof(MyApp.MyAppMainPage).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.ImageSource).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.StackLayout).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.Label).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.Button).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.FormattedString).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.Span).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.Image).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.ScrollView).GetTypeInfo().Assembly);
  assembliesToInclude.Add(typeof(Xamarin.Forms.WebView).GetTypeInfo().Assembly);
  // add this line
  Xamarin.Forms.Forms.Init(e,assembliesToInclude); // requires the `e` parameter
Run Code Online (Sandbox Code Playgroud)

其中MyAppMainPage是xaml页面,我尝试在我的PCL中加载,其余的是页面由UI组成的元素.

我现在看到为x86抛出此异常:

System.Private.Interop.dll中出现'System.PlatformNotSupportedException'异常抛出:System.Private.Threading.dll中出现'System.AggregateException'异常抛出:System.Private.Reflection.Core.dll中的'System.Reflection.MissingMetadataException'

为什么不支持该平台?Xamarin支持环球权利吗?

c# assemblies release xamarin uwp

16
推荐指数
1
解决办法
4318
查看次数

我可以签署一个我没有源代码的程序集吗?

我收到了第三方的集会.我需要将它添加到GAC,但它没有强名称.有没有办法让我使用自己的密钥签署程序集,以便它具有强大的命名?

.net assemblies

15
推荐指数
1
解决办法
2766
查看次数

.NET中的程序集位于何处?

我对.NET程序集的物理位置有点困惑.拿好旧的LINQ.在我的web.config文件中它说:

<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Run Code Online (Sandbox Code Playgroud)

这是对LINQ的引用.但是这个DLL到底在哪里?上面没有任何路径,它不在我的bin文件夹中.

我也有我认为的第三方汇编参考:

<add assembly="MapInfo.CoreTypes, Version=4.0.0.483, Culture=neutral, PublicKeyToken=F548BCBA69D4B8DA" />
Run Code Online (Sandbox Code Playgroud)

如果它不在bin文件夹中,我如何知道它在我的机器上的位置?

此外,如果DLL文件在bin目录中,我可以假设它不需要被引用web.config吗?

.net assemblies file-structure

15
推荐指数
4
解决办法
2万
查看次数

Maven:如何使用没有时间戳文件名的快照工件创建程序集?

我有一个包含带时间戳的快照工件的存储库.

我想创建一个包含依赖项的程序集.这很好用.但工件名称包含时间戳.所以我想知道如何仅从程序集的文件名中删除时间戳.

我已经使用了这个dependencySet:

<outputFileNameMapping>${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
Run Code Online (Sandbox Code Playgroud)

但版本接缝已包含时间戳.那么有没有机会获得1.1.1-SNAPSHOT而不是1.1.1-20100323.071348-182

我正在使用maven-assembly-plugin的2.2-beta-4版本.

versioning maven-2 assemblies artifacts maven-3

15
推荐指数
1
解决办法
8997
查看次数

Is it necessary to change the assemblyIdentity's version attribute in a manifest file?

In the following manifest, is it necessary to change the version attribute of the assemblyIdentity element if the assembly version is specified in the project (or, in my case, set as part of a MSBuild task)?

According to this Microsoft Connect page, it looks like the project's version number overrides the manifest's version number. Please correct me if I'm wrong...

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" 
                xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" 
                xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="MyApp.exe" type="win32"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> …
Run Code Online (Sandbox Code Playgroud)

assemblies version manifest

15
推荐指数
1
解决办法
7163
查看次数