gpt4 book ai didi

InfoPath 表单中的 C# 字符串插值

转载 作者:行者123 更新时间:2023-11-30 23:20:11 24 4
gpt4 key购买 nike

我正在尝试将一些代码添加到 InfoPath 2013 表单中,以便在 SharePoint 2013 网站上使用。

这似乎在安装 Visual Studio 2012 并通过 InfoPath 打开它后正常工作。

但是,在导入我的一些旧代码(使用 C# 6.0 中引入的字符串插值)之后,我现在看到这个错误:

Unexpected character '$'

在使用插值的行上。

我尝试运行 Install-Package Microsoft.Net.Compilers -Version 1.3.2,但 NuGet 提示说:

The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' has invalid child element 'developmentDependency' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.

List of possible elements expected: 'iconUrl, summary, title, projectUrl, references, frameworkAssemblies, copyright, releaseNotes, licenseUrl, tags, dependencies, language, description' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.

所以我尝试根据 this answer 更新 NuGet ,但后来我看到:

The term 'nuget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

这是怎么回事?我是在浪费时间尝试将 C# 6.0InfoPath 一起使用,还是我的配置有问题?

请注意,InfoPath 2013 仅在使用 Visual Studio 2012 时才允许自定义代码。否则我会使用 2015

最佳答案

我按照以下步骤解决了这个问题:

首先,使用以下方法更新 NuGet:

  1. 从“工具”菜单中选择“扩展和更新”。
  2. 然后在打开的对话框中选择“更新”选项卡。
  3. 然后选择 Visual Studio 库。
  4. 选择 NuGet Package Manager for Visual Studio 并点击更新按钮。

接下来,退出Visual Studio 2012 InfoPath 2013(注意只退出VS是不行的,因为 InfoPath 似乎在后台保持打开状态以便快速访问)。

现在,重新启动并重试。这一次,我能够在 Package Manager Console 中运行 Install-Package Microsoft.Net.Compilers 并且 C# 6.0 似乎已经安装.

VS2012 sill 将新的字符串插值处理为错误,因此这些确实出现在错误窗口中,我可以在文本编辑器中看到波浪形的红色下划线。

我选择放弃新的字符串插值,因为处理这些假错误太烦人了。为此,我卸载了 .csproj 文件并删除了对 Microsoft.Net.Compilers 的引用。

关于InfoPath 表单中的 C# 字符串插值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39853996/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com