在将使用SlimDX并因此具有非托管代码的项目转换为.NET 4.0时,我遇到了以下错误:
混合模式程序集是针对运行时的版本"v2.0.50727"构建的,如果没有其他配置信息,则无法在4.0运行时加载.
谷歌搜索给了我解决方案,这是将其添加到应用程序配置:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我的问题是,做了useLegacyV2RuntimeActivationPolicy什么?我找不到任何关于它的文档.
我正在尝试使用一个应用程序,该应用程序工作正常,我正在尝试编辑应用程序中的现有项目.点击编辑时出现以下错误,
System.Runtime.InteropServices.COMException was unhandled
Message="Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
Source="System.Windows.Forms"
ErrorCode=-2147221164
StackTrace:
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at bulk_lister.frm_edititem.InitializeComponent() in New Bulklister\new bulklister\bulk_lister\bulk_lister\frm_edititem.designer.cs:line 4248
at bulk_lister.frm_edititem..ctor(Int32 userid, Int32 intListingId) in New Bulklister\new bulklister\bulk_lister\bulk_lister\frm_edititem.cs:line 187
at bulk_lister.parent_form.funEditItem_fromrghtclktoolStrip_edititm() in New Bulklister\new bulklister\bulk_lister\bulk_lister\parent_form.cs:line 1313
at bulk_lister.parent_form.rghtclktoolStrip_edititm_Click(Object sender, EventArgs …Run Code Online (Sandbox Code Playgroud) 在64位计算机上从Visual Studio 2012运行应用程序,显示以下错误消息:
检索具有CLSID {F2D4F4E5-EEA1-46FF-A83B-A270C92DAE4B}的组件的COM类工厂由于以下错误而失败:80040154未注册类(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG))
我在visualstudio中使用Inventor packandgo dll库.
任何人都知道错误是什么?
我正在尝试创建一组我可以安排在将来运行的 C# 类。目的是通过我的代码的其他部分以编程方式安排这些。
这是我试图通过 COM 调用的当前类。
using System;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.Win32.TaskScheduler;
namespace SchedulableTasks
{
[Guid("F5CAE94C-BCC7-4304-BEFB-FE1E5D56309A")]
public class TaskRegistry : ITaskHandler
{
private ITaskHandler _taskHandler;
public void Start(object pHandlerServices, string data)
{
var arguments = data.Split('|');
var taskTypeName = arguments.FirstOrDefault();
var taskArguments = arguments.Skip(1).FirstOrDefault();
var taskType = Type.GetType(taskTypeName);
_taskHandler = (ITaskHandler) Activator.CreateInstance(taskType);
_taskHandler.Start(pHandlerServices, taskArguments);
}
public void Stop(out int pRetCode)
{
var retCode = 1;
_taskHandler?.Stop(out retCode);
pRetCode = retCode;
}
public void Pause()
{
_taskHandler.Pause();
}
public …Run Code Online (Sandbox Code Playgroud) 当然Embed interop类型功能是一件好事,但即使在简单的场景中也无法让它与我合作,所以请建议这是我在没有安装powerPoint的机器上运行我的项目时得到的错误:

我的代码非常简单我只是从powerPoint创建对象,创建演示文稿并在其中滑动写入内容.
我嵌入的库是Office和Microsoft.Office.Interop.PowerPoint
将构建配置转换为x68并没有解决它,
我正在构建Windows应用程序并按下单击按钮,如下所示:
private void button1_Click(object sender, EventArgs e)
{
var pp = new powerpoint.Application();
var oPres=pp.Presentations;
pp.Visible = Office.MsoTriState.msoTrue;
powerpoint.Presentation oPre= oPres.Add(Office.MsoTriState.msoTrue);
powerpoint.Slides oSlides = oPre.Slides;
powerpoint.Slide oSlide = oSlides.Add(1, powerpoint.PpSlideLayout.ppLayoutText);
powerpoint.Shapes oShapes = oSlide.Shapes;
powerpoint.Shape oShape = oShapes[1];
powerpoint.TextFrame oTxtFrame = oShape.TextFrame;
powerpoint.TextRange oTxtRange = oTxtFrame.TextRange;
oTxtRange.Text = "All-In-One Code Framework";
string fileName = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().Location) + "\\Sample1.pptx";
oPre.SaveAs(fileName,
powerpoint.PpSaveAsFileType.ppSaveAsOpenXMLPresentation,
Office.MsoTriState.msoTriStateMixed);
oPre.Close();
pp.Quit();
pp = null;
}
Run Code Online (Sandbox Code Playgroud)
在顶部,我补充说
using powerpoint …Run Code Online (Sandbox Code Playgroud) c# ×3
.net ×2
com ×2
.net-4.0 ×1
32-bit ×1
64-bit ×1
app-config ×1
dll ×1
mixed-mode ×1
powerpoint ×1
registry ×1
windows ×1
windows-10 ×1