相关疑难解决方法(0)

Visual Studio 2017 - 无法加载文件或程序集"System.Runtime,Version = 4.1.0.0"或其依赖项之一

我正在使用Visual Studio 2017,我正在尝试创建.Net Standard 1.5库并在.Net 4.6.2 nUnit测试项目中使用它.

我收到以下错误...

无法加载文件或程序集'System.Runtime,Version = 4.1.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.该系统找不到指定的文件.

我尝试过以下方法:

  1. 参考Std库作为项目参考.错误:给我以前的错误.
  2. 为我的Std库创建一个NuGet pkg并引用它.错误:类型是System.String,期望System.String.这是因为System.Runtime最终被项目引用,并且它具有所有标准类型的定义.
  3. 参考NuGet pkg NetStandard.Library.错误:给我与#相同的错误("类型是System.String,期望System.String").注意:在我这样做之前,我清除了项目中的所有NuGet包,然后只添加了nUnit和NetStandard.Library包(安装了45个其他包).

这是一个错误吗?有解决方法吗?任何帮助表示赞赏.

.net visual-studio-2017 .net-standard-1.5

89
推荐指数
7
解决办法
7万
查看次数

在位置安装文件的内容 - Program Files(x86)\ Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5

请耐心等待我,我会尽可能清楚地解释.

我开始了一个新项目(类库),其目标是4.5而不是客户端配置文件4.5.

我添加了一个引用"System.Runtime.Serialization",属性表明它位于"C:\ Program Files(x86)\ Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Runtime.Serialization.dll"的位置

在我的电脑上,使用msbuild编译构建脚本可以很好地编译.

在使用团队城市的构建服务器上 - 它抱怨

错误CS0012:类型'System.Object'在未引用的程序集中定义.您必须添加对程序集'System.Runtime,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'的引用

buildserver安装了完整的.net框架 - "dotnetfx45_full_x86_x64.exe"

它将构建的唯一时间是将我的"C:\ Program Files(x86)\ Reference Assemblies\Microsoft\Framework.NETFramework\v4.5"版本复制到目标计算机.

我已经使用此链接进行了检查并安装了.net 4.5 - http://myspworld.wordpress.com/2012/10/18/how-to-check-if-net-4-5-is-installed-on-a -服务器/

我问两个问题:1.如何安装?2.如果它确实在这个位置找到它肯定应该在GAC中查找?

将不胜感激任何帮助.

c# assemblies asp.net-mvc-4 .net-4.5

12
推荐指数
1
解决办法
2万
查看次数

显示Windows 10 Toast通知

我正在用C#(Visual Studio 2015)开发一个程序,我想在某种情况下向用户显示一个toast消息.我从MSDN下载了这段代码,运行正常:

// Get a toast XML template
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText04);

// Fill in the text elements
XmlNodeList stringElements = toastXml.GetElementsByTagName("text");
for (int i = 0; i < stringElements.Length; i++)
{
    stringElements[i].AppendChild(toastXml.CreateTextNode("Line " + i));
}

// Specify the absolute path to an image
String imagePath = "file:///" + Path.GetFullPath("toastImageAndText.png");
XmlNodeList imageElements = toastXml.GetElementsByTagName("image");
imageElements[0].Attributes.GetNamedItem("src").NodeValue = imagePath;

// Create the toast and attach event listeners
ToastNotification toast = new ToastNotification(toastXml);
toast.Activated += ToastActivated;
toast.Dismissed += ToastDismissed;
toast.Failed += …
Run Code Online (Sandbox Code Playgroud)

.net c# notifications visual-studio

10
推荐指数
1
解决办法
3万
查看次数