相关疑难解决方法(0)

System.BadImageFormatException:无法加载文件或程序集

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe C:\_PRODUKCIJA\D
ebug\DynamicHtmlTool.exe
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\_PRO
DUKCIJA\Debug\DynamicHtmlTool.exe' or one of its dependencies. An attempt was ma
de to load a program with an incorrect format..

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>
Run Code Online (Sandbox Code Playgroud)

服务是x86编译,即使两台计算机都是x64,它可以在我的计算机上运行.在服务器哪里是win 2008我得到这个错误.

我试试谷歌的解决方案但没有工作.

就像写在这里我有x86项目 http://www.davesquared.net/2008/12/systembadimageformatexception-on-64-bit.html

c# 64-bit

212
推荐指数
4
解决办法
37万
查看次数

将.net核心与遗留的.net框架dll一起使用

我可以将.net核心与遗留的.net框架dll一起使用吗?答案似乎不是......但我只能找到引用project.json的资源,而这些资源已经不存在了.

我创建了一个新的.net核心库,并试图引用一个遗留的.net框架DLL.当我试图调用DLL时,vs2017抱怨我没有Stream对象正在寻找.

它建议我引用mscorlib.dll或installa Nuget包.

快速帮助未能引用mscorlib.dll.如果我手动引用它,我会收到以下错误:

类型'TargetFrameworkAttribute'存在于'mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'和'System.Runtime,Version = 4.1.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'C:\ Users. .. \应用程序数据\本地\ Temp.NETCoreApp,版本= v1.1.AssemblyAttributes.cs

NuGet包是Microsoft.NETFx2.0.快速帮助无法安装它.如果我从命令行运行它:

> PM> install-package microsoft.netfx20   GET
> https://api.nuget.org/v3/registration2-gz/microsoft.netfx20/index.json
> OK
> https://api.nuget.org/v3/registration2-gz/microsoft.netfx20/index.json
> 46ms Restoring packages for ... Install-Package : Package
> Microsoft.NetFX20 1.0.3 is not compatible with netcoreapp1.1
> (.NETCoreApp,Version=v1.1). Package Microsoft.NetFX20 1.0.3 supports:
> net20 (.NETFramework,Version=v2.0)At line:1 char:1
> + install-package microsoft.netfx20
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     + CategoryInfo          : NotSpecified: …
Run Code Online (Sandbox Code Playgroud)

.net c# .net-core visual-studio-2017

12
推荐指数
3
解决办法
8400
查看次数

该平台不支持操作

我有一个简单的项目.NetFramework 3.5 Class library

我在项目中的(with )c# dynamic code处编译并运行,并从项目中调用。runtimeCodeDom.NetFrameworkAsp.NetCore 2.0

当我从项目中调用类BuildAssembly中的方法时,遇到此错误:(CodeDom 抛出)CommonAsp.NetCore 2.0

"System.PlatformNotSupportedException":"此平台不支持该操作。" 在 Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters 选项,String[] fileNames) 在 Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters 选项,String[] 源)

以下代码:

.NetFrameWork 3.5:

public class Common
{
    public Assembly BuildAssembly(string code)
    {
        CodeDomProvider codeProvider = CodeDomProvider.CreateProvider("CSharp");
        CompilerParameters compilerparams = new CompilerParameters();
        compilerparams.GenerateExecutable = false;//Generate an executable instead of a class library
        compilerparams.GenerateInMemory = false; //Save the assembly as a physical file.

        compilerparams.ReferencedAssemblies.Add("mscorlib.dll");
        compilerparams.ReferencedAssemblies.Add("System.dll");
        compilerparams.ReferencedAssemblies.Add("System.Data.dll");
        compilerparams.ReferencedAssemblies.Add("System.Xml.dll");

        CompilerResults results …
Run Code Online (Sandbox Code Playgroud)

c# .net-core asp.net-core-2.0

5
推荐指数
0
解决办法
8662
查看次数