未找到方法:'System.Type的System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(的System.Guid)' [英] Method not found: 'System.Type System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(System.Guid)'

查看:2949
本文介绍了未找到方法:'System.Type的System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(的System.Guid)'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了很多时间一个很好的协议对我开发框写这个程序,将其移动到我们的生产盒子,我得到下面的错误后。只是一个供参考我没有在什么安装,可安装的任何控制,我怎样才能使这项工作?在两台计算机上都的框架,我们有1.0.3705,V1.1.4322,V2.0.50727,V3.0,V3.5,4.0.30319。另外,节目我用来创建应用程序是Visual Studio的2013专业版。



感谢




请参阅此消息的结尾的详细信息,调用刚刚在时间
(JIT)调试而不是此对话框。



的**的 * 的**的 异常文本的 的**的 * 的**** system.missingMethodException而:未找到方法:'System.Type的
System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(的System.Guid)。
在C_Sharp_version.Form1.button4_Click(对象发件人,EventArgs的)结果
在System.Windows.Forms.Control.OnClick(EventArgs e)上
System.Windows.Forms.Button .OnClick(EventArgs e)上
System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)在
System.Windows.Forms.Control.WmMouseUp(消息和M,MouseButtons
键, INT32点击)在
System.Windows.Forms.Control.WndProc(消息和M)在
System.Windows.Forms.ButtonBase.WndProc(消息和M)在
System.Windows。 Forms.Button.WndProc(消息和M)在
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息和M)
在System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和;
M)在System.Windows.Forms.NativeWindow.Callback(IntPtr的的HWND,的Int32
味精,IntPtr的WPARAM,LPARAM的IntPtr)



的**的 * 的**的 加载的程序集的 的**的 * 的**** 的mscorlib
议会版本:4.0.0.0
Win32版本:4.0.30319.239(RTMGDR.030319-2300)
基本代码:文件:/// C:/Windows/Microsoft.NET /Framework/v4.0.30319/mscorlib.dll
------------------------------------ ----升C版本
议会版本:1.0.0.0
Win32版本:1.0.0.0
基本代码:文件:/// gordonc $ /桌面/ C%20Sharp%20version 20% (2).exe文件
----------------------------------------系统.Windows.Forms
议会版本:4.0.0.0
Win32版本:4.0.30319.235通过内置:RTMGDR
基本代码:文件:/// C:/Windows/Microsoft.Net/assembly/ GAC_MSIL / System.Windows.Forms的/ v4.0_4.0.0.0__b77a5c561934e089 / System.Windows.Forms.dll的
----------------------- ----------------- System.Drawing中
议会版本:4.0.0.0
Win32版本:4.0.30319.1通过内置:RTMRel
基本代码:文件:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------- -----------------------------系统
议会版本:4.0.0.0
Win32版本:4.0.30319.236 RTMGDR
基本代码:文件:由内置/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll


< /块引用>

 使用系统; 
使用System.Collections.Generic;
使用System.ComponentModel;
使用System.Data这;
使用System.Drawing中;
使用System.Linq的;
使用System.Text;使用System.Threading.Tasks
;使用System.Windows.Forms的
;
:使用System.IO;使用Word =的Microsoft.Office.Interop.Word
;
使用的Microsoft.Office.Interop.Word;


命名空间C_Sharp_version
{
公共部分Form1类:表格
{
公共Form1中()
{
的InitializeComponent();
}
私人无效FindAndReplace(Microsoft.Office.Interop.Word.Application DOC,FINDTEXT对象,对象replaceWithText)
{
//选项
对象matchCase = FALSE ;
对象matchWholeWord = TRUE;
对象matchWildCards = FALSE;
对象matchSoundsLike = FALSE;
对象matchAllWordForms = FALSE;
对象向前= TRUE;
对象格式= FALSE;
对象matchKashida = FALSE;
对象matchDiacritics = FALSE;
对象matchAlefHamza = FALSE;
对象matchControl = FALSE;
对象READ_ONLY = FALSE;
对象可见=真实的;
对象替换= 2;
对象包= 1;
//执行查找和替换
doc.Selection.Find.Execute(REF FINDTEXT,裁判matchCase,裁判matchWholeWord,
裁判matchWildCards,裁判matchSoundsLike,裁判matchAllWordForms,REF前进,裁判包装,参考格式,裁判replaceWithText,裁判取代,
裁判matchKashida,裁判matchDiacritics,裁判matchAlefHamza,裁判matchControl);
}

私人无效的button1_Click(对象发件人,EventArgs五)
{
打开文件对话框openInfDoc =新的OpenFileDialog();

如果(openInfDoc.ShowDialog()== System.Windows.Forms.DialogResult.OK)
{
串strInfDocLocation = openInfDoc.FileName;

MessageBox.Show(strInfDocLocation);
InfDocLocationtxt.Text = strInfDocLocation;
}
}

私人无效button2_Click(对象发件人,EventArgs五)
{
打开文件对话框openNetdoc =新的OpenFileDialog();
如果(openNetdoc.ShowDialog()== System.Windows.Forms.DialogResult.OK)
{
串strNetDocLocation = openNetdoc.FileName;

MessageBox.Show(strNetDocLocation);
NetDocLocationtxt.Text = strNetDocLocation;
}
}

私人无效button3_Click(对象发件人,EventArgs五)
{
打开文件对话框openChkdoc =新的OpenFileDialog();
如果(openChkdoc.ShowDialog()== System.Windows.Forms.DialogResult.OK)
{
串strChkDocLocation = openChkdoc.FileName;

MessageBox.Show(strChkDocLocation);
ChkDocLocationtxt.Text = strChkDocLocation;
}
}

私人无效button4_Click(对象发件人,EventArgs五)
{
目标文件名= Path.Combine(System.Windows.Forms的。 Application.StartupPath,InfDocLocationtxt.Text);
Microsoft.Office.Interop.Word.Application wordApp =新Microsoft.Office.Interop.Word.Application {可见=真};
Microsoft.Office.Interop.Word.Document ADOC = wordApp.Documents.Open(REF文件名,只读:假的,可见的:真正的);
aDoc.Activate();
FindAndReplace(wordApp,<服务器>中,textBox1.Text);
FindAndReplace(wordApp,<域名>中,textBox2.Text);
FindAndReplace(wordApp,<知识产权及GT;,textBox3.Text);
FindAndReplace(wordApp,<&工程师GT;,textBox4.Text);
FindAndReplace(wordApp,<日期和GT;,textBox5.Text);
FindAndReplace(wordApp,<项目>中,textBox6.Text);
FindAndReplace(wordApp,<集群与GT;,textBox7.Text);
FindAndReplace(wordApp,&所述; DocNumber>中,textBox8.Text);
FindAndReplace(wordApp,<作者>中,textBox9.Text);


}

私人无效button7_Click(对象发件人,EventArgs五)
{

}

私人无效button5_Click(对象发件人,EventArgs五)
{
目标文件名= Path.Combine(System.Windows.Forms.Application.StartupPath,NetDocLocationtxt.Text);
Microsoft.Office.Interop.Word.Application wordApp =新Microsoft.Office.Interop.Word.Application {可见=真};
Microsoft.Office.Interop.Word.Document ADOC = wordApp.Documents.Open(REF文件名,只读:假的,可见的:真正的);
aDoc.Activate();
FindAndReplace(wordApp,<服务器>中,textBox1.Text);
FindAndReplace(wordApp,<域名>中,textBox2.Text);
FindAndReplace(wordApp,<知识产权及GT;,textBox3.Text);
FindAndReplace(wordApp,<&工程师GT;,textBox4.Text);
FindAndReplace(wordApp,<日期和GT;,textBox5.Text);
FindAndReplace(wordApp,<项目>中,textBox6.Text);
FindAndReplace(wordApp,<集群与GT;,textBox7.Text);
FindAndReplace(wordApp,&所述; DocNumber>中,textBox8.Text);
FindAndReplace(wordApp,<作者>中,textBox9.Text);
}

私人无效button6_Click(对象发件人,EventArgs五)
{
目标文件名= Path.Combine(System.Windows.Forms.Application.StartupPath,ChkDocLocationtxt 。文本);
Microsoft.Office.Interop.Word.Application wordApp =新Microsoft.Office.Interop.Word.Application {可见=真};
Microsoft.Office.Interop.Word.Document ADOC = wordApp.Documents.Open(REF文件名,只读:假的,可见的:真正的);
aDoc.Activate();
FindAndReplace(wordApp,<服务器>中,textBox1.Text);
FindAndReplace(wordApp,<域名>中,textBox2.Text);
FindAndReplace(wordApp,<知识产权及GT;,textBox3.Text);
FindAndReplace(wordApp,<&工程师GT;,textBox4.Text);
FindAndReplace(wordApp,<日期和GT;,textBox5.Text);
FindAndReplace(wordApp,<项目>中,textBox6.Text);
FindAndReplace(wordApp,<集群与GT;,textBox7.Text);
FindAndReplace(wordApp,&所述; DocNumber>中,textBox8.Text);
FindAndReplace(wordApp,<作者>中,textBox9.Text);
}


}
}


解决方案

在我看来,作为一个 .NET框架 兼容性问题。



问题:您已经开发在本地计算机应用程序与 .NET Framework的版本heigher 运行在具有 .NET框架的低版本的远程PC相同



请注意:如果您针对您的应用程序在 Heigher .NET框架,它不会在较低版本上运行。版本

$运行b
$ b

解决方案:您需要将其定位到 .NET框架可供选择的较低版本的远程PC上运行。在远程PC



第1步:右键点击项目 - 选择属性



第二步:修改目标框架 .NET框架XX .NET框架XY



请注意:这里的 XX 是heigher和 XY 可在远程PC或更低的较低版本版本。


I spent a good deal of time writing this program on my dev box, after moving it to our production boxes I get the error below. Just an FYI I don't have any control over what is installed and what can be installed, how can I make this work? Under both framework on both computers we have v1.0.3705, v1.1.4322, v2.0.50727, v3.0, v3.5, 4.0.30319. Also the program I used to create the app is Visual Studio 2013 Pro.

Thanks

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

***** Exception Text ******* System.MissingMethodException: Method not found: 'System.Type System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(System.Guid)'. at C_Sharp_version.Form1.button4_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

***** Loaded Assemblies ******* mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.239 (RTMGDR.030319-2300) CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll ---------------------------------------- C Sharp version Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///gordonc$/Desktop/C%20Sharp%20version%20(2).exe ---------------------------------------- System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.235 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.236 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Word = Microsoft.Office.Interop.Word;
using Microsoft.Office.Interop.Word;


namespace C_Sharp_version
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void FindAndReplace(Microsoft.Office.Interop.Word.Application doc, object findText, object replaceWithText)
        {
            //options
            object matchCase = false;
            object matchWholeWord = true;
            object matchWildCards = false;
            object matchSoundsLike = false;
            object matchAllWordForms = false;
            object forward = true;
            object format = false;
            object matchKashida = false;
            object matchDiacritics = false;
            object matchAlefHamza = false;
            object matchControl = false;
            object read_only = false;
            object visible = true;
            object replace = 2;
            object wrap = 1;
            //execute find and replace
            doc.Selection.Find.Execute(ref findText, ref matchCase, ref matchWholeWord,
                ref matchWildCards, ref matchSoundsLike, ref matchAllWordForms, ref forward, ref wrap, ref format, ref replaceWithText, ref replace,
                ref matchKashida, ref matchDiacritics, ref matchAlefHamza, ref matchControl);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openInfDoc = new OpenFileDialog();

            if (openInfDoc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string strInfDocLocation = openInfDoc.FileName;

                MessageBox.Show(strInfDocLocation);
                InfDocLocationtxt.Text = strInfDocLocation; 
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog openNetdoc = new OpenFileDialog();
            if (openNetdoc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string strNetDocLocation = openNetdoc.FileName;

                MessageBox.Show(strNetDocLocation);
                NetDocLocationtxt.Text = strNetDocLocation;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog openChkdoc = new OpenFileDialog();
            if (openChkdoc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string strChkDocLocation = openChkdoc.FileName;

                MessageBox.Show(strChkDocLocation);
                ChkDocLocationtxt.Text = strChkDocLocation;
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            object fileName = Path.Combine(System.Windows.Forms.Application.StartupPath, InfDocLocationtxt.Text);
            Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application { Visible = true };
            Microsoft.Office.Interop.Word.Document aDoc = wordApp.Documents.Open(ref fileName, ReadOnly: false, Visible: true);
            aDoc.Activate();
            FindAndReplace(wordApp, "<ServerName>", textBox1.Text);
            FindAndReplace(wordApp, "<Domain>", textBox2.Text);
            FindAndReplace(wordApp, "<Ip>", textBox3.Text);
            FindAndReplace(wordApp, "<Engineer>", textBox4.Text);
            FindAndReplace(wordApp, "<Date>", textBox5.Text);
            FindAndReplace(wordApp, "<Project>", textBox6.Text);
            FindAndReplace(wordApp, "<Cluster>", textBox7.Text);
            FindAndReplace(wordApp, "<DocNumber>", textBox8.Text);
            FindAndReplace(wordApp, "<Author>", textBox9.Text);


        }

        private void button7_Click(object sender, EventArgs e)
        {

        }

        private void button5_Click(object sender, EventArgs e)
        {
            object fileName = Path.Combine(System.Windows.Forms.Application.StartupPath, NetDocLocationtxt.Text);
            Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application { Visible = true };
            Microsoft.Office.Interop.Word.Document aDoc = wordApp.Documents.Open(ref fileName, ReadOnly: false, Visible: true);
            aDoc.Activate();
            FindAndReplace(wordApp, "<ServerName>", textBox1.Text);
            FindAndReplace(wordApp, "<Domain>", textBox2.Text);
            FindAndReplace(wordApp, "<Ip>", textBox3.Text);
            FindAndReplace(wordApp, "<Engineer>", textBox4.Text);
            FindAndReplace(wordApp, "<Date>", textBox5.Text);
            FindAndReplace(wordApp, "<Project>", textBox6.Text);
            FindAndReplace(wordApp, "<Cluster>", textBox7.Text);
            FindAndReplace(wordApp, "<DocNumber>", textBox8.Text);
            FindAndReplace(wordApp, "<Author>", textBox9.Text);
        }

        private void button6_Click(object sender, EventArgs e)
        {
            object fileName = Path.Combine(System.Windows.Forms.Application.StartupPath, ChkDocLocationtxt.Text);
            Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application { Visible = true };
            Microsoft.Office.Interop.Word.Document aDoc = wordApp.Documents.Open(ref fileName, ReadOnly: false, Visible: true);
            aDoc.Activate();
            FindAndReplace(wordApp, "<ServerName>", textBox1.Text);
            FindAndReplace(wordApp, "<Domain>", textBox2.Text);
            FindAndReplace(wordApp, "<Ip>", textBox3.Text);
            FindAndReplace(wordApp, "<Engineer>", textBox4.Text);
            FindAndReplace(wordApp, "<Date>", textBox5.Text);
            FindAndReplace(wordApp, "<Project>", textBox6.Text);
            FindAndReplace(wordApp, "<Cluster>", textBox7.Text);
            FindAndReplace(wordApp, "<DocNumber>", textBox8.Text);
            FindAndReplace(wordApp, "<Author>", textBox9.Text);
        }


    }
}

解决方案

it seems to me as a .NET Framework compatibility issue.

Problem : you have developed your application in your local machine with heigher version of .NET Framework and running the same on remote pc having Lower Version of.NET Framework.

Note : if you target your application to run on Heigher Version of .NET Framework it wont run on lower versions.

Solution : you need to target it to .NET Framework Lower Version available on your remote PC to run on remote pc.

Step 1: right click on project - select properties

Step 2: change the Target Framework from .NET Framework x.x to .NET Framework x.y.

Note : where x.x is heigher and x.y is lower version available on remote pc or any lower version.

这篇关于未找到方法:'System.Type的System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(的System.Guid)'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆