OneDrive 上的 Visual Studio 项目

问题描述 投票:0回答:1

我目前正在开发一个小型控制台应用程序,试图慢慢地重新开始编码

将文件转换为字节数组并将其存储在项目中的另一个文件夹中没有什么特别的工作,非常简单。 但是,当尝试访问测试文件或什至将转换后的文件保存到项目内的文件夹时,我会收到错误

我以为一切都会正常进行,但我收到以下错误

System.IO.DirectoryNotFoundException:'无法找到路径的一部分'C:\ Users \ gavin \ OneDrive \ Documents \ Portfolio \ ByteConverter in \ Debug et6.0\ConvertedToByte est'.'

现在在我的本地 C 驱动器上测试了相同的功能,没有遇到任何错误 我想将内容保留在我的 OneDrive 上,但这不可能吗?还是我需要在 Visual Studio 中启用我不知道的功能?

编辑: 我忘记包含我的代码,很抱歉已经指出这一点,我将继续将其包含在此处

Using System.IO;

namespace BystConverter
{
    
    public class converter
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");
            

(此处出现错误异常v)

          File.WriteAllBytes("ConvertedToByte/test",SaveByteArrayToFile("C:/Users/gavin/Documents/Testfiles/925821-DDAL_08-02_Beneath_the_City_of_the_Dead_V1.0.pdf"));
            Console.WriteLine("Complete");
        }
        public static byte[] SaveByteArrayToFile(string filepath)
        {
            byte[] filebyteArray = File.ReadAllBytes(filepath);
            return filebyteArray;
        }
        
}


}
c# visual-studio onedrive
1个回答
0
投票

正如 Dai 所说,OneDrive 并不是实际版本控制系统的替代品。 OneDrive 不保证对目录进行快照的能力,并且排除特定目录(如 bin、node_modules 等)非常困难。 VS 设计为与 git(和其他 MSSCCI 兼容系统)一起使用,而不是与 OneDrive 一起使用。

你可以尝试使用正式的版本控制系统:Git

请参考:https://learn.microsoft.com/zh-cn/visualstudio/version-control/?view=vs-2022

© www.soinside.com 2019 - 2024. All rights reserved.