Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Resolved 2019.3.12f1 Build Errors

Discussion in 'Editor & General Support' started by Sean2212, Apr 30, 2020.

  1. Sean2212

    Sean2212

    Joined:
    Jun 9, 2017
    Posts:
    6
    After upgrading a project from 2019.3.11f1 to 2019.3.12f1 I'm getting build errors in Visual Studio. Code builds fine with 2019.3.11f1.

    To reproduce:
    1. Create a new "High Definition RP" project from Unity Hub (2.3.1).
    2. Once Unity has loaded, from the menu select Assets -> Open C# Project.
    3. In Visual Studio, from the menu select Build -> Build Solution.

    I get several of these errors:

    Severity Code Description Project File Line Suppression State
    Error CS0246 The type or namespace name 'Readme' could not be found (are you missing a using directive or an assembly reference?) Assembly-CSharp-Editor E:\Unity Projects\Test 2019.3.12f1 HDRP\Assets\TutorialInfo\Scripts\Editor\ReadmeEditor.cs 9 Active


    Do the same with 2019.3.11f1 and it works just fine. Anyone else getting similar issues?

    Unity will still build and run ok - just seems Visual Studio can't figure things out. Looks like it's only having issues with "xxx-Editor" projects in the solution.

    Using Visual Studio Community 2019 (16.5.4).
     
    Last edited: Apr 30, 2020
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    9,031
    What did you expect to happen building from VS? If you want to build from VS instead of the editor, you go into build settings and check the Create Visual Studio Solution checkbox (available for Windows builds only), then run the build. This will create a new VS project with everything needed to create a final executable from VS outside of Unity. You then open that newly created solution with VS and build from there.

    Otherwise you use VS as your code editor and Unity to create builds.

    https://docs.unity3d.com/Manual/BuildSettings.html

    Maybe I'm not understanding what your issue is?
     
  3. Erothez

    Erothez

    Joined:
    May 27, 2015
    Posts:
    20
    Ran into this issue recently, appears 12f1 now adds "<ReferenceOutputAssembly>false</ReferenceOutputAssembly>" for assemble definition projects so it fails to find the assembly. Appears splitting up the "Generate .csproj files for:" has broke something.

    If you remove that line from any csproj it will be fine. If you tick the boxes for any of those .csproj generate boxes it will break that package/library as well with the same missing assembly reference.
     
    ajh_unity505 and Pronetizen like this.
  4. Erothez

    Erothez

    Joined:
    May 27, 2015
    Posts:
    20
    @Joe-Censored it would be nice to continue using my attached IDE vs2019 for debugging and coding without intellisense giving lots of false positives when it worked perfectly fine on 11f1.
     
  5. Sean2212

    Sean2212

    Joined:
    Jun 9, 2017
    Posts:
    6
    Joe-Censored: I'm talking about building the C# code in Visual Studio - not genering a Unity executable.
     
  6. Sean2212

    Sean2212

    Joined:
    Jun 9, 2017
    Posts:
    6
    Thanks, @Erothez that was the problem. Seems upgrading to 2019.3.12.f1 has updated "Visual Studio Code Editor" package from 1.1.4 to 1.2.0 which must have then added "<ReferenceOutputAssembly>false</ReferenceOutputAssembly>".
     
    jeffweber likes this.
  7. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    443
    Thank you for this! I have submitted bug# 1243129 in regards to this problem! For now, I'm going to downgrade back to 1.1.4 of the visual studio code package.

    Edit: Even after downgrading and using 1.1.4 of the visual studio code package, Unity is adding this property to the projects. So this must be a Unity 2019.3.12 "feature" that is causing this problem. Hopefully, they can emergency fix it for the next release. If anyone has enterprise support, I'd love to have them get on top of this.
     
    Last edited: May 1, 2020
    fherbst and Erothez like this.
  8. Sean2212

    Sean2212

    Joined:
    Jun 9, 2017
    Posts:
    6
    Thanks, @Ferazel - was about to log a bug. Even if you remove "ReferenceOutputAssembly" from the projects as soon as you edit any scripts it gets added back. :(
     
  9. Pronetizen

    Pronetizen

    Joined:
    Nov 11, 2018
    Posts:
    6
    Thank you Erothez for letting me know the cause!
    I got the exactly same issue here after upgrading to 2019.3.12f1.

    Here's an Editor script snippet for temporary workaround.
    Hope this issue resolved as soon as possible.

    Code (CSharp):
    1. using System.IO;
    2. using UnityEditor.Callbacks;
    3. using UnityEngine;
    4.  
    5. public class Unity2019312f1Fix
    6. {
    7. #pragma warning disable IDE0051 // Remove unused private members
    8.     [DidReloadScripts]
    9.     private static void OnScriptsReloaded()
    10.     {
    11.         Debug.Log("Fixing all csproj files...");
    12.         foreach (var filename in Directory.GetFiles(".", "*.csproj"))
    13.         {
    14.             var csprojContent = File.ReadAllText(filename);
    15.             var fixedCsprojContent = csprojContent.Replace("<ReferenceOutputAssembly>false</ReferenceOutputAssembly>", "<ReferenceOutputAssembly>true</ReferenceOutputAssembly>");
    16.             if (csprojContent != fixedCsprojContent)
    17.             {
    18.                 File.WriteAllText(filename, fixedCsprojContent);
    19.                 Debug.Log("    " + filename);
    20.             }
    21.             else
    22.             {
    23.                 Debug.Log("    " + filename + " (skipped)");
    24.             }
    25.         }
    26.         Debug.Log("...Done");
    27.     }
    28. #pragma warning restore IDE0051 // Remove unused private members
    29. }
    30.  
    31.  
     
    Last edited: May 1, 2020
    JustAnotherDude likes this.
  10. atmikes1234

    atmikes1234

    Joined:
    Apr 21, 2019
    Posts:
    4
    Yep, here too. I'm using BestHTTP (from asset store) in Unity 2019.3.12, when i do ReimportAll in unity, all is fine, but as soon as i change a script and Unity compiles, it looses References to BestHTTP in VS2019.

    Going back to 2019.3.11. @Unity: please fix! :) thx!
     
  11. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    561
    I slightly fixed your hotfix for my project. This works for me.

    Code (CSharp):
    1. using UnityEditor;
    2. public class SolutionFileFixer : AssetPostprocessor
    3. {
    4.     private static string OnGeneratedCSProject(string path, string content)
    5.     {
    6.         return content.Replace("<ReferenceOutputAssembly>false</ReferenceOutputAssembly>", "<ReferenceOutputAssembly>true</ReferenceOutputAssembly>");
    7.     }
    8. }
     
  12. Pronetizen

    Pronetizen

    Joined:
    Nov 11, 2018
    Posts:
    6
    @Kichang-Kim Oh, that's much better! Thanks for the tip! :)
     
    Erothez likes this.
  13. IkaBika

    IkaBika

    Joined:
    Jul 23, 2013
    Posts:
    54
    Also in "Library\PackageCache\com.unity.ide.vscode@1.2.0\Editor\ProjectGeneration\ProjectGeneration.cs"

    Code (CSharp):
    1. projectBuilder.Append("      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>").Append(k_WindowsNewline);
    Can tweak this.
     
  14. Groble-Inc

    Groble-Inc

    Joined:
    Dec 30, 2015
    Posts:
    2
    I have the same problem.
    I sent a bug report.

    VS 2017.
     
  15. Erothez

    Erothez

    Joined:
    May 27, 2015
    Posts:
    20
    Can confirm that @Kichang-Kim's fix works as a workaround until this is fixed properly in Unity. Although I like the fact they have brought the Generate All project options to 2019.3 just a shame doesn't quite work right. Its seems the 2019.3.12f1 backport has introduced a regression that should not need worked around. :(
     
  16. jawad_ahmad

    jawad_ahmad

    Joined:
    Apr 28, 2017
    Posts:
    25
    This worked great! Thank you for this!
     
  17. levwsr

    levwsr

    Joined:
    Jul 23, 2012
    Posts:
    67
    this is terrible.. please fix asap unity
     
  18. positive

    positive

    Joined:
    May 29, 2014
    Posts:
    1
    It looks this doesn't work. there might be another place to generate this line in csproj.
     
  19. judah4

    judah4

    Joined:
    Feb 6, 2011
    Posts:
    232
    Thank you for this! I was trying everything to try to fix the references between refreshing Visual Studio and Rider. For now I'm downgrading to 2019.3.11f1 until this is fixed.
     
  20. forestrf

    forestrf

    Joined:
    Aug 28, 2010
    Posts:
    99
    +1 thank you for this! I lost several hours trying things and searching for a fix
     
  21. PacoLabs

    PacoLabs

    Joined:
    Jun 29, 2017
    Posts:
    28
    Thank you all for the workaround,
    I was also having the problem moving from 2019.3.11f1 to 2019.3.12f1
     
  22. Emery-Monzerol

    Emery-Monzerol

    Joined:
    Nov 1, 2012
    Posts:
    5
    Worked for my team as well. Many thanks for the workaround :)
     
  23. Erothez

    Erothez

    Joined:
    May 27, 2015
    Posts:
    20
    Appears fixed in 2019.3.13f1 for those interested. No longer requires @Kichang-Kim 's workaround.
     
unityunity