Visual studio 获取有关所需成员的错误

Visual studio 获取有关所需成员的错误,visual-studio,winrt-xaml,Visual Studio,Winrt Xaml,我正在Visual Studio 2013中开发一个Windows 8.1应用程序,以便在运行时创建Excel工作表。Visual Studio未显示任何错误,但当我运行应用程序时,出现了一个运行时错误,即: 错误1缺少所需的编译器成员 'System.Runtime.InteropServices.LCIDConversionAttribute..ctor'D:\GS\Projects\excel\excel\CSC excel 这是我的CS代码: using System; using Sy

我正在Visual Studio 2013中开发一个Windows 8.1应用程序,以便在运行时创建Excel工作表。Visual Studio未显示任何错误,但当我运行应用程序时,出现了一个运行时错误,即:

错误1缺少所需的编译器成员 'System.Runtime.InteropServices.LCIDConversionAttribute..ctor'D:\GS\Projects\excel\excel\CSC excel

这是我的CS代码:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace excel
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
            Microsoft.Office.Interop.Excel.Workbook workbook = null;
            Microsoft.Office.Interop.Excel.Workbooks workbooks = null;
            Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
            workbooks = excelApp.Workbooks;
            workbook = workbooks.Add(1);
            worksheet = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Sheets[1];
            excelApp.Visible = true;
            worksheet.Cells[1, 1] = "Value1";
            worksheet.Cells[1, 2] = "Value2";
            worksheet.Cells[1, 3] = "Addition";
        }
    }
}
使用系统;
使用System.Collections.Generic;
使用System.IO;
使用System.Linq;
使用System.Runtime.InteropServices.WindowsRuntime;
使用Windows基金会;
使用Windows。
使用Windows.UI.Xaml;
使用Windows.UI.Xaml.Controls;
使用Windows.UI.Xaml.Controls.Primitives;
使用Windows.UI.Xaml.Data;
使用Windows.UI.Xaml.Input;
使用Windows.UI.Xaml.Media;
使用Windows.UI.Xaml.Navigation;
//空白页项模板被记录在http://go.microsoft.com/fwlink/?LinkId=234238
名称空间excel
{
/// 
///可以单独使用或在框架内导航到的空页。
/// 
公共密封部分类主页面:第页
{
公共主页()
{
this.InitializeComponent();
Microsoft.Office.Interop.Excel.Application excelApp=新的Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook工作簿=空;
Microsoft.Office.Interop.Excel.Workbooks Workbooks=null;
Microsoft.Office.Interop.Excel.\u工作表=null;
工作簿=excelApp.工作簿;
工作簿=工作簿。添加(1);
工作表=(Microsoft.Office.Interop.Excel.worksheet)workbook.Sheets[1];
excelApp.Visible=true;
工作表。单元格[1,1]=“Value1”;
工作表。单元格[1,2]=“Value2”;
工作表.单元格[1,3]=“加法”;
}
}
}
在上述代码中,VS-2013中没有显示错误的红线。 我为Excel添加了引用:
Microsoft.Office.Interop.Excel


有人有解决方案吗?

很抱歉,您无法从应用商店应用程序自动化office。如果您想创建一个电子表格,我会考虑使用syncfusion的docio之类的工具,我尝试使用syncfusion.core dll创建电子表格,然后出现另一个错误。为了解决这个错误,我下载了Syncfusion.XlsIO.Base dll,然后出现了另一个错误。为了解决这个错误,我下载了Microsoft.Office.Interop.Excel,显然这里有一个错误。有人有解决方案吗?