Skip to content

Failure to build when using Visual Studio 2019 without manual NuGet package restore #12373

Closed

Description

@xtqqczze

Build was attempted using Microsoft Visual Studio Community 2019 Version 16.5.4

Error	NU1105	Unable to find project information for 'X:\PowerShell\src\Microsoft.Management.UI.Internal\Microsoft.PowerShell.GraphicalHost.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.	powershell-win-core	X:\PowerShell\src\powershell-win-core\powershell-win-core.csproj	1	

Activity

  1. added
    Issue-Question
    on Apr 18, 2020
  2. xtqqczze commented on Apr 18, 2020

    @xtqqczze
    ContributorAuthor
    Error	NU1201	Project Microsoft.PowerShell.GraphicalHost is not compatible with netcoreapp5.0 (.NETCoreApp,Version=v5.0). Project Microsoft.PowerShell.GraphicalHost supports: net50 (.NETFramework,Version=v5.0)	powershell-win-core	X;\PowerShell\src\powershell-win-core\powershell-win-core.csproj	1	
    
  3. xtqqczze commented on Apr 18, 2020

    @xtqqczze
    ContributorAuthor

    The following commands ran once via the developer PowerShell allow me to build the solution in Visual Studio.

    msbuild -t:restore; Import-Module ./build.psm1; Start-PSBuild
    
  4. iSazonov commented on Apr 22, 2020

    @iSazonov
    Collaborator

    We use TFM "netcoreapp5.0" but should "net5.0".

  5. added
    WG-Maintainers-Build
    on Apr 22, 2020
  6. vexx32 commented on Apr 22, 2020

    @vexx32
    Collaborator
  7. iSazonov commented on Apr 22, 2020

    @iSazonov
    Collaborator

    Docs https://github.com/dotnet/designs/blob/master/accepted/2020/net5/net5.md

    GitHub
    This repo is used for reviewing new .NET designs. Contribute to dotnet/designs development by creating an account on GitHub.
  8. TravisEz13 commented on Apr 22, 2020

    @TravisEz13
    Member

    Honestly, we need a maintainer of the solution. I don't use the solution because it's only problematic for me. cc Dongbo Wang (@daxian-dbw)

  9. iSazonov commented on Apr 22, 2020

    @iSazonov
    Collaborator

    Usually VS public update is needed to work stable with latest .Net preview.

  10. xtqqczze commented on Apr 27, 2020

    @xtqqczze
    ContributorAuthor

    Ilya (@iSazonov) Build was attempted using Microsoft Visual Studio Community 2019 Version 16.5.4

  11. iSazonov commented on Apr 28, 2020

    @iSazonov
    Collaborator

    xtqqczze We moved to TFM "net5.0" today. You could try with latest master.

  12. xtqqczze commented on Apr 28, 2020

    @xtqqczze
    ContributorAuthor

    Using 7c1cc86, the solution fails to build from a clean workspace using "Build Solution" from within Visual Studio. It would therefore appear the move to net5.0 does not affect this issue.

    Additionally invoking Start-PSBuild fails too unless a manual NuGet package restore is performed first with msbuild -t:restore.

    As I indicated earlier, building from within Visual Studio suceeds as long as a command line build with msbuild -t:restore; Import-Module ./build.psm1; Start-PSBuild has suceeded previously.

  13. changed the title [-]Fails to build when targeting netcoreapp5.0 using Visual Studio 2019[/-] [+]Failure to build when using Visual Studio 2019 without manual NuGet package restore[/+] on Apr 28, 2020
  14. TravisEz13 commented on Apr 28, 2020

    @TravisEz13
    Member

    xtqqczze Import-Module ./build.psm1; Start-PSBuild I always do this before trying to build with the solution. I think this is expected.

    Is the msbuild restore step really needed, because Start-PSBuild does that again if it's not already done.

  15. vexx32 commented on Apr 28, 2020

    @vexx32
    Collaborator

    I've often found that in a clean workspace or after some commits have been pulled in I'll need to Start-PSBuild -Clean which prompts it to take a couple extra steps that seem to be required in certain cases.

  16. TravisEz13 commented on Apr 28, 2020

    @TravisEz13
    Member

    xtqqczze This sounds like an issue in visual studio not realizing it needs to restore. I'm not sure what to tell you. You or someone else could add a -RestoreAll switch to start-psbuild.

    The sln is only there as a connivence. We make no guarantees for it working to actually build.

    Ilya (@iSazonov) has been doing good working getting rid of the workarounds we use in start-psbuild, but the team at Microsoft, we don't have an immediate goal to build using Visual Studio. There is still one workaround, TypeGen which I haven't seen him attempt to eliminate.

    As far as why we don't restore everything, we know we can't cross compile, so we limit what we have dotnet restore to save time and disk.

  17. xtqqczze commented on Apr 28, 2020

    @xtqqczze
    ContributorAuthor

    Rain Sallow (/u/ta11ow) (@vexx32) I have now found that if Start-PSBuild -Clean is used as you suggested than msbuild -t:restore is unnecessary.

    Travis Plunk (@TravisEz13) It seems that if Visual Studio is opened before running Start-PSBuild then the environment becomes polluted somehow (likely from an automatic restore). I'm closing this issue but will open a new one concerning the build documentation as it is badly outdated.

  18. xtqqczze commented on Apr 28, 2020

    @xtqqczze
    ContributorAuthor

    To resolve this issue Import-Module ./build.psm1; Start-PSBuild -Clean should be ran with Visual Studio closed. After building from the command line once, then "Build Solution" from within Visual Studio seems to work.

  19. iSazonov commented on Apr 29, 2020

    @iSazonov
    Collaborator

    TypeGen which I haven't seen him attempt to eliminate.

    Travis Plunk (@TravisEz13) I did the attempt years ago but MSFT team said "Oh, no..." :-) If I remember right the team wanted to avoid complex csproj files and prefer PowerShell script. But the TypeGen (like resgen) is stable and we could move it to csproj that helps to build on VS 2019.

    If you want I could try to move TypeGen to csproj (It will work like resgen works now)

  20. TravisEz13 commented on Apr 29, 2020

    @TravisEz13
    Member

    I don't want to move it but it would be required for msbuild or visual studio to work perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-QuestionWG-Maintainers-Build

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions