none
compiling error about solution not finding its own file path RRS feed

  • Question

  • i'm taking an old project from 2010 and trying to cut/paste my code into a new solution file by file... so far so good but

    i get this error : 

    Severity Code Description Project File Line Suppression State
    Error CS2001 Source file 'C:\C#\Latin Project 2_2\Latin Project 2_2\..\..\..\..\..\..\C#\Latin Project 2_2\formLatinProejct.cs' could not be found. Latin Project 2_2 C:\C#\Latin Project 2_2\Latin Project 2_2\CSC 1 Active

    and have no idea what to do with it!?


    my code is perfect until i don't find a bug

    Thursday, October 18, 2018 10:16 AM

All replies

  • Seems that your project includes a file that does not exist on disk in the specified location.

    If you found this file in some of the folders (maybe called “formLatinProject.cs” instead of “formLatinProejct.cs”), then try removing the node from the project in Solution Explorer, then use “Add Existing Item” from Project menu to insert it back.



    • Edited by Viorel_MVP Thursday, October 18, 2018 10:30 AM
    Thursday, October 18, 2018 10:25 AM
  • Hello, 

    >and have no idea what to do with it!?

    Your path to source file contain 3 steps into subfolders and 6 back references (..) - this is far outside hard drive.

    Unload your project, open it in editor and fix paths to the files.

    Xmmm... may be a glitch - just unload Studio and re-load it again. 


    Sincerely, Highly skilled coding monkey.

    Thursday, October 18, 2018 10:27 AM
  • ok, that's what I was thinking had to be done but I don't know where to find the 'paths to files' you're referring to.

    my code is perfect until i don't find a bug

    Thursday, October 18, 2018 1:51 PM
  • thanks for the help but i have no \C# path that is a sub-directory of C:\C#\ directory 

    i try double clicking on the error to send me to the line i need to correct but this doesn't happen.

    i can fix the path if i can only find the line that needs fixing ...


    my code is perfect until i don't find a bug

    Thursday, October 18, 2018 1:53 PM
  • Its in your *.vbproj/*.csproj files.

    Unload - left click on project -> right click on project -> Unload Project.

    Then you will be able to open *.*proj in Studio editor and fix paths.

    Other way - use some side editor... Notepad... 


    Sincerely, Highly skilled coding monkey.

    Thursday, October 18, 2018 2:02 PM
  • If you look at the path it is trying to find you'll notice that it starts in what is probably your project path. Then it steps back until it gets to the root and then steps back into the parent directory. That would really be equivalent to this (I believe): ..\formLatinProejct.cs so just go back one directory and find the file. Note that the file seems to be misspelled.

    I really question the approach you're taking though. It seems long and convoluted. Did you try to just open the SLN file in VS? It should try to auto-import everything so you don't have to do anything but fix the errors.

    If that doesn't work then create a new project in VS for each of your original projects. Then go to your original project folder structure and drag and drop all the files and folders from the old project folder to the new one. Fix any project references, add any additional NuGet/binary references and recompile.


    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, October 18, 2018 3:58 PM
    Moderator
  • i don't understand your instructions.  left click / right click 

    neither click on file menu's 'Project' option produces any 'unload' option.

    I'm working in C# maybe that's the reason ... can you be more clear?


    my code is perfect until i don't find a bug

    Thursday, October 18, 2018 5:24 PM
  • Unload Project

    You also can edit your project file in Notepad. It's simple XML file.


    Sincerely, Highly skilled coding monkey.


    Thursday, October 18, 2018 8:26 PM
  •  thanks but this is all i found :

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup> 
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
        </startup>
    </configuration>


    my code is perfect until i don't find a bug

    Thursday, October 18, 2018 9:21 PM
  • It's not a project file, it's an app.config file. 

    Project file looks like 

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
        <ProductVersion>8.0.30703</ProductVersion>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{C909EB23-A889-4F3A-A73D-F66FED9EBBC0}</ProjectGuid>
        <OutputType>WinExe</OutputType>
        <AppDesignerFolder>Properties</AppDesignerFolder>
        <RootNamespace>WindowsFormsApplication1</RootNamespace>
        <AssemblyName>WindowsFormsApplication1</AssemblyName>
        <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
        <TargetFrameworkProfile>Client</TargetFrameworkProfile>
        <FileAlignment>512</FileAlignment>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
        <PlatformTarget>x86</PlatformTarget>
        <DebugSymbols>true</DebugSymbols>
        <DebugType>full</DebugType>
        <Optimize>false</Optimize>
        <OutputPath>bin\Debug\</OutputPath>
        <DefineConstants>DEBUG;TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
        <PlatformTarget>x86</PlatformTarget>
        <DebugType>pdbonly</DebugType>
        <Optimize>true</Optimize>
        <OutputPath>bin\Release\</OutputPath>
        <DefineConstants>TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <ItemGroup>
        <Reference Include="System" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml.Linq" />
        <Reference Include="System.Data.DataSetExtensions" />
        <Reference Include="Microsoft.CSharp" />
        <Reference Include="System.Data" />
        <Reference Include="System.Deployment" />
        <Reference Include="System.Drawing" />
        <Reference Include="System.Windows.Forms" />
        <Reference Include="System.Xml" />
      </ItemGroup>
      <ItemGroup>
        <Compile Include="Calc.cs" />
        <Compile Include="Form3.cs">
          <SubType>Form</SubType>
        </Compile>
        <Compile Include="Form3.Designer.cs">
          <DependentUpon>Form3.cs</DependentUpon>
        </Compile>
        <Compile Include="Form1.cs">
          <SubType>Form</SubType>
        </Compile>
        <Compile Include="Form1.Designer.cs">
          <DependentUpon>Form1.cs</DependentUpon>
        </Compile>
        <Compile Include="Form2.cs">
          <SubType>Form</SubType>
        </Compile>
        <Compile Include="Form2.Designer.cs">
          <DependentUpon>Form2.cs</DependentUpon>
        </Compile>
        <Compile Include="Form4.cs">
          <SubType>Form</SubType>
        </Compile>
        <Compile Include="Form4.Designer.cs">
          <DependentUpon>Form4.cs</DependentUpon>
        </Compile>
        <Compile Include="Program.cs" />
        <Compile Include="Properties\AssemblyInfo.cs" />
        <EmbeddedResource Include="Form3.resx">
          <DependentUpon>Form3.cs</DependentUpon>
        </EmbeddedResource>
        <EmbeddedResource Include="Form1.resx">
          <DependentUpon>Form1.cs</DependentUpon>
        </EmbeddedResource>
        <EmbeddedResource Include="Form2.resx">
          <DependentUpon>Form2.cs</DependentUpon>
        </EmbeddedResource>
        <EmbeddedResource Include="Form4.resx">
          <DependentUpon>Form4.cs</DependentUpon>
        </EmbeddedResource>
        <EmbeddedResource Include="Properties\Resources.resx">
          <Generator>ResXFileCodeGenerator</Generator>
          <LastGenOutput>Resources.Designer.cs</LastGenOutput>
          <SubType>Designer</SubType>
        </EmbeddedResource>
        <Compile Include="Properties\Resources.Designer.cs">
          <AutoGen>True</AutoGen>
          <DependentUpon>Resources.resx</DependentUpon>
        </Compile>
        <None Include="Properties\Settings.settings">
          <Generator>SettingsSingleFileGenerator</Generator>
          <LastGenOutput>Settings.Designer.cs</LastGenOutput>
        </None>
        <Compile Include="Properties\Settings.Designer.cs">
          <AutoGen>True</AutoGen>
          <DependentUpon>Settings.settings</DependentUpon>
          <DesignTimeSharedInput>True</DesignTimeSharedInput>
        </Compile>
      </ItemGroup>
      <ItemGroup>
        <Content Include="Data\File.txt">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
      </ItemGroup>
      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
      <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
           Other similar extension points exist, see Microsoft.Common.targets.
      <Target Name="BeforeBuild">
      </Target>
      <Target Name="AfterBuild">
      </Target>
      -->
    </Project>


    Sincerely, Highly skilled coding monkey.

    Thursday, October 18, 2018 9:35 PM
  • right.  this is my app.config file :

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup> 
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
        </startup>
    </configuration>
    


    my code is perfect until i don't find a bug

    Thursday, October 18, 2018 10:57 PM
  • Hi BadButBit,

    Have you solved your question? If yes, please mark the useful reply as answer. 

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, October 19, 2018 6:26 AM
    Moderator
  •  no.

    I cannot find the file reference that is causing the error.


    my code is perfect until i don't find a bug.

    not sure what happened but now its telling me : 

    Error CS0103 The name 'InitializeComponent' does not exist in the current context Latin Project 2_2 C:\C#\Latin Project 2_2\Latin Project 2_2\formLatinProject_2_2.cs 82 Active

    so I commented it out and its finding other run-time errors ... i'll hit those and get back to you.

    thank you, BadButBit

    Friday, October 19, 2018 6:48 AM
  • Forms have 2 files (that's one reason why doing a file copy isn't the best way to upgrade a solution). You need to bring across your formLatinProject_2_2.designer.cs file as well. That is where the second half of the form code resides including InitializeComponent.

    However since you didn't put it in the project at the same time as the .cs file you're now going to have both files show up in Solution Explorer. Unless VS has gotten smarter and figures it out then you'll have to fix the file nesting manually.


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, October 19, 2018 1:44 PM
    Moderator