Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在其他PC上部署.NET控制台应用程序_C#_.net - Fatal编程技术网

C# 在其他PC上部署.NET控制台应用程序

C# 在其他PC上部署.NET控制台应用程序,c#,.net,C#,.net,今天我建立了两个快速程序。我在这里展示的只是一个将虚拟机的日期更改为特定日期的快速程序。我已经测试并部署了它,但没有用,我无法让它在另一台机器上工作。我通过以下文档对我的工作进行了双重检查。这两台电脑都运行.NET4.7。我不确定是什么问题。感谢您的帮助 错误: 错误:未找到依赖项清单中指定的程序集--包:“microsoft.codeanalysis.common”,版本:“1.3.0”,路径:“lib/netstandard1.3/microsoft.codeanalysis.dll” Pr

今天我建立了两个快速程序。我在这里展示的只是一个将虚拟机的日期更改为特定日期的快速程序。我已经测试并部署了它,但没有用,我无法让它在另一台机器上工作。我通过以下文档对我的工作进行了双重检查。这两台电脑都运行.NET4.7。我不确定是什么问题。感谢您的帮助

错误:

错误:未找到依赖项清单中指定的程序集--包:“microsoft.codeanalysis.common”,版本:“1.3.0”,路径:“lib/netstandard1.3/microsoft.codeanalysis.dll”

Project.cs

using System; 
using System.IO; 
using System.Runtime.InteropServices; 
using System.Windows;

namespace vmRedundancy {

class Program {

    public struct SYSTEMTIME {
        public ushort wYear, wMonth, wDayOfWeek, wDay,
        wHour, wMinute, wSecond, wMilliseconds;
    }
    /// <param name="lpSystemTime">[out]</param>
    [DllImport ("kernel32.dll")]
    public extern static void GetSystemTime (ref SYSTEMTIME lpSystemTime);
    /// <param name="lpSystemTime">[in]</param>
    [DllImport ("kernel32.dll")]
    public extern static uint SetSystemTime (ref SYSTEMTIME lpSystemTime);

    static void Main (string[] args) {
        SYSTEMTIME st = new SYSTEMTIME();
        GetSystemTime(ref st);
        Console.WriteLine("The date was: " + st.wMonth + @"\" + st.wDay + @"\" + st.wYear); 
        st.wDay = 1;
        st.wMonth = 6;
        st.wYear = 2017;
        SetSystemTime(ref st);
        Console.WriteLine("The date is: " + st.wMonth + @"\" + st.wDay + @"\" + st.wYear); 
        //Console.WriteLine("The day of the week is: " + st.wDayOfWeek); 4
        Console.WriteLine("The time is: " + (st.wHour - 4) + ":" + st.wMinute + ":" + st.wSecond + " " + st.wMilliseconds + "ms"); 
            Console.ReadKey();
        }
    }
}
dotnet--信息(部署)

.NET命令行工具(1.0.4)

产品信息:
版本:1.0.4
提交SHA-1哈希:af1e6684fd

运行时环境:
操作系统名称:Windows
操作系统版本:10.0.15063 操作系统平台:Windows
RID:win10-x64
基本路径:C:\Program Files\dotnet\sdk\1.0.4

dotnet——信息(客户端)

.NET命令行工具(1.0.4)

产品信息:
版本:1.0.4
提交SHA-1哈希:af1e6684fd

运行时环境:
操作系统名称:Windows
操作系统版本:6.1.7601
操作系统平台:Windows
RID:win7-x64
基本路径:C:\Program Files\dotnet\sdk\1.0.4


我能够通过下载和安装.NET4.7SDK并根据需要更改一切来实现这一点。“核心”编译项不能跨不同平台工作,这似乎很奇怪。我肯定我误解了什么;我只是不知道是什么

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
    <TargetFramework>net47</TargetFramework>
  </PropertyGroup>

</Project>

Exe
win7-x64
网络47

我能够通过下载和安装.NET 4.7 SDK并根据需要更改一切来实现这一点。“核心”编译项不能跨不同平台工作,这似乎很奇怪。我肯定我误解了什么;我只是不知道是什么

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
    <TargetFramework>net47</TargetFramework>
  </PropertyGroup>

</Project>

Exe
win7-x64
网络47

根据错误,您没有包括二进制文件所需的所有DLL。请检查:@Juan这适用于Visual Studio IDE。我正在使用dotnet控制台编译器进行构建和发布。我理解这一点,但问题仍然是一样的。您缺少一个库(如链接中所示),因此我希望这可以帮助您找出它丢失的原因。根据错误,您没有包括二进制文件所需的所有DLL。请检查:@Juan this适用于Visual Studio IDE。我正在使用dotnet控制台编译器进行构建和发布。我理解这一点,但问题仍然是一样的。您丢失了一个库(如链接中所示),因此我希望这可以帮助您找出它丢失的原因。
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
    <TargetFramework>net47</TargetFramework>
  </PropertyGroup>

</Project>