Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Visual Studio won't sync anymore

Discussion in 'Editor & General Support' started by FeastSC2, Jan 8, 2018.

  1. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    974
    I have this error and now my Visual Studio won't sync with Unity anymore.

    Does anyone have a clue why? :D

    ArgumentException: Value does not fall within the expected range.
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit)
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder..ctor ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnPreGeneratingCSProjectFiles ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.AssetPostprocessingInternal.OnPreGeneratingCSProjectFiles () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:61)
    UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:189)
    UnityEditor.SyncVS.CreateIfDoesntExist () (at C:/buildslave/unity/build/Editor/Mono/SyncProject.cs:147)
    UnityEditor.EditorGUILayout:propertyField(SerializedProperty, GUILayoutOption[])
    Sirenix.OdinInspector.Editor.InspectorUtilities:BeginDrawPropertyTree(PropertyTree, Boolean) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Infos/InspectorPropertyInfo.cs:464)
    Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Utilities/Persistent/PersistentContextCache.cs:416)
    Sirenix.OdinInspector.Editor.OdinEditor:OnInspectorGUI() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/DrawerPriorityAttribute.cs:44)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    What do you mean by "sync", can you elaborate a bit more? Is this error in the console? Does this occur on a new project with a new script?
     
  3. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    974
    Thanks for taking interest.
    This only happens in my big project and by synchronizing I mean that my solution's scripts are not up-to-date, as an example if I create a new script Test.cs it won't show up in my Solution Explorer.

    So VS intellisense gives me errors by saying some classes are not found but when playing the game it works fine because Unity recognizes there are actually no errors as it does find the classes VS doesn't find.
     
  4. Korno

    Korno

    Joined:
    Oct 26, 2014
    Posts:
    518
  5. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
  6. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    974
    Unity 2017.3.0f3 and VS 2017.

    I think the problem might be due to something I have in my project because I don't have this problem in new projects.

    Is there a way I can track where the problem comes from in my big project?
     
  7. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Do you have the unity visual studio tools installed separately? If so try removing those as they come with now. I saw a related post that said someone had similar issues because of that.

    I'm using the latest 2017.3 patch release and latest VS 2017 also, and not having issues. So if your VS is the very latest I would suspect something like the separate install of VS tools for unity maybe being the cause.
     
  8. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    974
    If it was related to my Visual Studio why would it work fine in other projects? I don't think that's the issue in my case.

    Visual Studio Tools was installed during the Visual Studio installation.

    EDIT: You may be right because it works fine with Visual Studio 2015.
    Opening with 2015 allowed me to sync the 2017 version, but upon using the 2017
    the error comes back.

    I will try to reinstall 2017 but it's a long and annoying process with all the plugins so for now I'll stick to 2015.
     
    Last edited: Jan 9, 2018
  9. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    I have the same problem to, with Visual studio 2013 and 2017 in Unity 2017.3 it wont start Visual studio when I click the Assets/Open C# Project just gives me the error below. And if I create a new script in Unity and have the project open in visual studio it wont appear there and I cant get the project to reload to show it. This all used to work perfectly but has now stopped working. I have installed the Post Processor Stack V2 which I think currently is the cause of the problem somehow.

    ArgumentException: Value does not fall within the expected range.
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit)
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder..ctor ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnPreGeneratingCSProjectFiles ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.AssetPostprocessingInternal.OnPreGeneratingCSProjectFiles () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:61)
    UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:189)
    UnityEditor.SyncVS.SyncVisualStudioProjectIfItAlreadyExists () (at C:/buildslave/unity/build/Editor/Mono/SyncProject.cs:165)
     
  10. Korno

    Korno

    Joined:
    Oct 26, 2014
    Posts:
    518
    Same here, It happened after I installed the post processing pack 2 from github.
    Pretty sure it has something to do with the new assembly definition stuff.
    I appended CSharp to both of the assembly definition names that the processing stuff uses and it seems to have gone away but still getting project errors sometimes.
     
    FeastSC2 likes this.
  11. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    974
    Ah good to know Korno, I installed the post processing stack 2 from Github too. I'll remove it now and see what happens.

    EDIT: It's now fixed as soon as I removed the processing stack 2!
     
    Last edited: Jan 14, 2018
  12. watercat

    watercat

    Joined:
    Dec 14, 2016
    Posts:
    13
    if enther the program i have this error all error is for unity 2018.1.0b4

    1
    ArgumentException: Value does not fall within the expected range.
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit)
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder..ctor ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnPreGeneratingCSProjectFiles ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.AssetPostprocessingInternal.OnPreGeneratingCSProjectFiles () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:61)
    UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:198)
    UnityEditor.SyncVS.SyncVisualStudioProjectIfItAlreadyExists () (at C:/buildslave/unity/build/Editor/Mono/SyncProject.cs:165)

    2
    ArgumentException: Value does not fall within the expected range.
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit)
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder..ctor ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnPreGeneratingCSProjectFiles ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.AssetPostprocessingInternal.OnPreGeneratingCSProjectFiles () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:61)
    UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:198)
    UnityEditor.SyncVS.SyncSolution () (at C:/buildslave/unity/build/Editor/Mono/SyncProject.cs:192)

    and if play buld for pc mode i have this error
    1
    ArgumentException: Value does not fall within the expected range.
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit)
    SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder..ctor ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject ()
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnPreGeneratingCSProjectFiles ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.AssetPostprocessingInternal.OnPreGeneratingCSProjectFiles () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:61)
    UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:198)
    UnityEditor.SyncVS.SyncSolution () (at C:/buildslave/unity/build/Editor/Mono/SyncProject.cs:192)
    2
    Exception: C:\Program Files\Unity 2018.1.0b4\Editor\Data\il2cpp/build/il2cpp.exe did not run properly!
    UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:130)
    UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1 setupStartInfo) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
    UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1 arguments, System.Action`1 setupStartInfo, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:349)
    UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (ICollection`1 userAssemblies, System.String outputDirectory, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:330)
    UnityEditorInternal.IL2CPPBuilder.Run () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:161)
    UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, IIl2CppPlatformProvider platformProvider, System.Action`1 modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:41)
    DesktopStandalonePostProcessor.SetupStagingArea (BuildPostProcessArgs args) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:172)
    DesktopStandalonePostProcessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:18)
    UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at C:/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:27)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:285)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    3
    Error building Player: 3 errors
    4
    Build completed with a result of 'Failed'
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    5
    UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:182
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:89
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  13. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    974
    I think you guys should check your project root folder wherever the .csproj of your Visual Studio is and remove anything that's unnecessary.
     
    Last edited: Jan 27, 2018
    ProtonOne likes this.
  14. nbg_yalta

    nbg_yalta

    Joined:
    Oct 3, 2012
    Posts:
    378
    Getting this everytime I trying to open a script in a new clean project
    VS 2015 pro
    Unity 2018.2.0b1

     
  15. MafiaMoe

    MafiaMoe

    Joined:
    Mar 24, 2013
    Posts:
    26
    All my projects updated to 2018.1 throw this error. My older projects using 2017.3.1f1 function normally.

    I also cleaned out all unnecessary files where there .csproj is located with no change.

    Code (CSharp):
    1. ArgumentException: Value does not fall within the expected range.
    2. SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit)
    3. SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits (System.String method)
    4. SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits ()
    5. SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder..ctor ()
    6. SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase ()
    7. SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject ()
    8. SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnPreGeneratingCSProjectFiles ()
    9. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    10. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    11. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    12. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    13. UnityEditor.AssetPostprocessingInternal.OnPreGeneratingCSProjectFiles () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:91)
    14. UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:196)
    15. UnityEditor.SyncVS.SyncVisualStudioProjectIfItAlreadyExists () (at C:/buildslave/unity/build/Editor/Mono/SyncProject.cs:163)
     
    Last edited: May 7, 2018
    TakuanDaikon likes this.
  16. whilefun

    whilefun

    Joined:
    Nov 14, 2013
    Posts:
    130
  17. dmangames

    dmangames

    Joined:
    Apr 8, 2016
    Posts:
    1
    I had this error
    Code (CSharp):
    1. ArgumentException: Value does not fall within the expected range.
    when I updated unity to 2018.1
    To fix, I removed the unity plugin for visual studios. Then updated visual studios.
    I closed and reopened Unity and did Assets>Open C# project
    Then my solution built and I could see all my files again in visual studios
     
    tapiralec1 likes this.
  18. Salman9k

    Salman9k

    Joined:
    Apr 7, 2018
    Posts:
    3
    Thanks dmangames, it did the trick
     
  19. BenjaminD

    BenjaminD

    Joined:
    Oct 15, 2016
    Posts:
    1
    I have tried every single fix that I can find on the web.
    • Unity 2018.1.0f2 64bit
    • vs 2017 community
    • fresh installs of both vs and unity
    • new project, old project, all the same.
    • tried using older versions of vs
    Error message in unity.
    Code (CSharp):
    1. ArgumentException: Value does not fall within the expected range.
    2. SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit)
    No sln files. I cannot even ignore the problem as it causes builds to fail.

    Update. I now have a solution file, I am not sure what changed, other than setting unity external tools to vs2015 (tried this last night with no luck, not sure why it is working today). But now I am getting this in my vs ActivityLog.

    Code (CSharp):
    1. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at SyntaxTree.VisualStudio.Unity.Editor.MessageClassificationTagger.IsMessageIdentifierSpan(SnapshotSpan span) at SyntaxTree.VisualStudio.Unity.Editor.MessageClassificationTagger.<GetTags>d__7.MoveNext() at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__38.MoveNext() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
     
    Last edited: May 19, 2018
  20. smatthews1999

    smatthews1999

    Joined:
    Jan 14, 2018
    Posts:
    9
    Could you please elaborate on where the Visual Studio Plugin for Unity is, and how to uninstall/reinstall it?
     
  21. tapiralec1

    tapiralec1

    Joined:
    Jun 29, 2016
    Posts:
    1

    Had this issue for months, this did the trick, thanks!
     
  22. AnatS

    AnatS

    Joined:
    Dec 12, 2018
    Posts:
    1
    I had a similar problem - I solved it by adding a .cs file (of unity monobehaviour) in Visual Studio instead in Unity.
    The file appeared in Unity and I connected it with the script component, and also it was sync by Visual Studio.
    If someone wants screen shots for more explanation send me a reply or something.
     
  23. Mgaia-Studio

    Mgaia-Studio

    Joined:
    Jul 22, 2014
    Posts:
    11
    I just had the same problem. Unity 2017.3.0p3, Visual Studio 2017 15.0.

    Solved it by updating Visual Studio 2017 to the latest version, 15.9.7. Updating only did not fix the problem promptly: after I finished the installation, the wizard stayed open and gave me te option to repair my installation, which I did and finally fixed the issue.

    Not sure if it made any difference, but before updating VS I deleted all the .csproj and .sln from my Unity project folder.