Search Unity

Error building project with visual studio in Unity 2018 : Unity Package Source file not found error

Discussion in 'Editor & General Support' started by ldhongen1990, May 10, 2018.

  1. ldhongen1990

    ldhongen1990

    Joined:
    Dec 18, 2015
    Posts:
    61
    When I tried to build and attach my visual studio debugger to Unity I got lots of
    "CSC : error CS2001: Source file could not be found." related to the new Package Manager.

    It must be related to the new package manager, and when visual studio tries to locate some "embedded c# script" they could not be found.

    Anybody encountered this issue and has found a fix or workaround for it?
     
    Opabin likes this.
  2. Opabin

    Opabin

    Joined:
    Sep 1, 2014
    Posts:
    1
    I have the same exact thing happening with all of my projects I create in Unity 2018.2.0f2. A bunch of CS2001 errors for each file within each of the packages that are by default loaded in with the new package manager.

    It does not seem to prevent me from writing scripts and running them in the Unity Editor but I can't use Visual Studio to compile without getting 45 errors having to do with package files that Visual Studio can't find/read.

    I have tried removing the packages and re-adding them and also recreating projects. Seems to be a continuous issue for me. I guess I can live with it for the time being but it is hard to ignore 45 unrelated red X's every time I try to build my scripts.
     
  3. MrClauclau

    MrClauclau

    Joined:
    Jul 14, 2013
    Posts:
    5
    I had the same issue, but installing the latest version of Visual Studio Community 2017 fixed the problem for me ! :)

    I actually deleted all the .csproj and the .sln. Then after having installed the latest visual studio update, I reopened a script from the editor, and Unity properly recreated the .csprojs and the .sln with ONLY my project scripts.

    (so 4 .csprojs and 1 .sln, but not the ton of unwanted packages .csproj it was generating before the visual studio update)
     
    Chaosed0 and antsonthetree like this.
  4. kofe

    kofe

    Joined:
    Aug 4, 2015
    Posts:
    4
    Confirm the issue. I download Text mesh Pro with Package Manager and I can use asset in editor, but VS 2017 can't find any references to Text Mesh Pro scripts
    Unity please fix this issue, or remove Packeg Manager from 2018 verision, thx.
     
  5. kofe

    kofe

    Joined:
    Aug 4, 2015
    Posts:
    4
    OK, for now I fixed this issue (don't think this is the best way but still):
    I discovered that VS can't see some files



    That was because there no any files like that in my project, so then:
    1) Some googling (https://stackoverflow.com/questions...editor-standardevents-already-exists-packages).
    2) So I discover the path to the cache (C:\Users\(name of your account)\AppData\Local\Unity). Folks says to remove everything from there, but i just copy folders "Scripts" and "Test" from
    C:\Users\ (name of your account) \AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.textmeshpro@1.2.4;
    3) and paste it to the corresponding project folder (\ProjectPath\Packages\com.unity.textmeshpro).

    And it seems to work fine.

    Since that i think that something goes wrong when Unity tried to check cache and accidentally concluded that files are already exists in project.
     
  6. MaXi_JP

    MaXi_JP

    Joined:
    Nov 27, 2013
    Posts:
    5
    Same problem here. Anything official?
     
  7. derElbi

    derElbi

    Joined:
    Nov 8, 2017
    Posts:
    2
    Having the same issue after updating from 2017.x to 2018.2.3f1.
     
  8. M-Hanssen

    M-Hanssen

    Joined:
    Sep 8, 2014
    Posts:
    34
    Same issue here, cannot debug in Visual Studio since 2018.2.x! At least not when using the package manager:(
     
  9. Rilesly

    Rilesly

    Joined:
    Mar 27, 2018
    Posts:
    2
    Same issue, and above work-around didn't work for me
     
  10. x_dfo

    x_dfo

    Joined:
    Jan 19, 2017
    Posts:
    6
    Deleting the cache worked for me, thanks!
     
  11. camsha

    camsha

    Joined:
    Nov 18, 2013
    Posts:
    11
    Deleting the cache didn't work for me. I tried uninstalling Unity and installed 2018.2.5f1. That did not help. I upgraded from VS 2017 15.5.x to 15.8.1. That worked!
     
    carocky likes this.
  12. morciba

    morciba

    Joined:
    Mar 13, 2016
    Posts:
    1
    Had same problem.

    Try VisualStudio Update. It worked for me.
     
    gconhub01 and carocky like this.
  13. Rilesly

    Rilesly

    Joined:
    Mar 27, 2018
    Posts:
    2
    Updated to 15.8.2 still broken for me
     
  14. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    I use VS 2015, as 2017 is pretty unusable for me. Is there an update/fix I could get for 2015?
     
  15. balar_86

    balar_86

    Joined:
    Apr 3, 2018
    Posts:
    4
    Fixed the same issue by removing and reinstalling the TextMesh Pro package from Package manager worked for me.
     
  16. Lost-in-the-Garden

    Lost-in-the-Garden

    Joined:
    Nov 18, 2015
    Posts:
    176
    On Unity 2018.2.6f1, just upgraded to VS2017 community 15.8.2, deleted the solution and project files, reopened the c# project, but still the source files of the pacakge manger still are not found and cause CS2001 errors.

    edit: deleting the library folder and every I could find, helped and it is now compiling :D
     
    Last edited: Sep 6, 2018
  17. Dissolute

    Dissolute

    Joined:
    Oct 6, 2012
    Posts:
    2
    I was encountering this issue (Unity 2018.2, VS 15.5.4) and resolved it by creating an empty Assembly Definition at the top level of my scripts folder.
     
  18. akajan

    akajan

    Joined:
    Sep 13, 2018
    Posts:
    1
    As an absolute beginner on this platform, I was disheartened because I couldn't get going the very basic application.
    Even with latest Unity Pro and VS2017 I got 46 errors and don't understand where the problem is.
    Please Microsoft do something about this!
     
  19. artbabygame

    artbabygame

    Joined:
    Jan 28, 2016
    Posts:
    1
    That worked for me!!! Thanks!
     
  20. EricJ13

    EricJ13

    Joined:
    Feb 28, 2009
    Posts:
    355
    This worked for me, Unity 2018.2.16f1, VS 15.9.2
     
    mikeohc likes this.
  21. IllTemperedTunas

    IllTemperedTunas

    Joined:
    Aug 31, 2012
    Posts:
    782
    Having this same issue with post processing assets and textmeshpro. Not sure how to fix.
     
  22. carocky

    carocky

    Joined:
    Dec 14, 2016
    Posts:
    1
    Visual Studio update works for me too!

    I had VS 2017 15.5.7, and just upgraded from Unity 2017 to Unity 2018.3. Same issues as everyone else. But upgrading VS to 2017 to 15.9.5 worked straight away. And no files ever get populated in the project directory (only a few of the directories for any loaded packages).
     
    IllTemperedTunas likes this.
  23. kiiri2

    kiiri2

    Joined:
    Feb 15, 2017
    Posts:
    4
    Using Unity 2018.3.1f1 and VS 2017, this solution worked for me. Just removing all the folders in the commented directory. Thanks a lot!
     
  24. yagoqueck

    yagoqueck

    Joined:
    Mar 25, 2017
    Posts:
    1
    Deleting cache did the trick. Thanks

    Several binding to unity problems since working with 2018 version... hope for no more issues
     
  25. dpham

    dpham

    Joined:
    Jun 6, 2015
    Posts:
    6
    Deleted Library folder worked for me.
     
  26. sunwakka

    sunwakka

    Joined:
    Apr 7, 2019
    Posts:
    1
    I fixed it by uninstalling vs 2017 and installing vs 2019
     
  27. ldhongen1990

    ldhongen1990

    Joined:
    Dec 18, 2015
    Posts:
    61
    Thanks for the suggested solution guys, I am currently using VSCode cause it boots up way faster and is more lightweighted. I generally find it easier to just close VSCode and reopen it again if the IDE starts behaving inappropriately. One thing I missed though is Visual studio ability to gray out code that are not valid in context for a particular #If. I may go back to Visual Studio one fine day and see if this problem is still there.
     
  28. omarashrafshokry

    omarashrafshokry

    Joined:
    May 19, 2019
    Posts:
    1
    unity you suck ,you have all of this programmers working on you and then a stupid error comes like this
    lol this can be a problem with VS i think you just have to upgrade it and it will help
     
  29. javanoob

    javanoob

    Joined:
    Aug 15, 2012
    Posts:
    64
    Yeah im done running in Circles Unreal Engine here I come and NEVER coming back I wasted 5 years !!!!!!!!!!!
     
  30. ohthepain

    ohthepain

    Joined:
    May 31, 2017
    Posts:
    100
    Let us know how it goes. Unity is a joke.
     
  31. unity_LYTD7ApB6AnR2A

    unity_LYTD7ApB6AnR2A

    Joined:
    Jun 6, 2019
    Posts:
    1
    Going to package manager and updating version control worked for me.