You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failure to build when using Visual Studio 2019 without manual NuGet package restore #12373
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aWG-Maintainers-Buildspecific to affecting the build
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
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.
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
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.
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.
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.
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.
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)
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aWG-Maintainers-Buildspecific to affecting the build
Activity
xtqqczze commentedon Apr 18, 2020
xtqqczze commentedon Apr 18, 2020
The following commands ran once via the developer PowerShell allow me to build the solution in Visual Studio.
iSazonov commentedon Apr 22, 2020
We use TFM "netcoreapp5.0" but should "net5.0".
vexx32 commentedon Apr 22, 2020
/cc Travis Plunk (@TravisEz13)
iSazonov commentedon Apr 22, 2020
Docs https://github.com/dotnet/designs/blob/master/accepted/2020/net5/net5.md
TravisEz13 commentedon Apr 22, 2020
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)
iSazonov commentedon Apr 22, 2020
Usually VS public update is needed to work stable with latest .Net preview.
xtqqczze commentedon Apr 27, 2020
Ilya (@iSazonov) Build was attempted using Microsoft Visual Studio Community 2019 Version 16.5.4
iSazonov commentedon Apr 28, 2020
xtqqczze We moved to TFM "net5.0" today. You could try with latest master.
xtqqczze commentedon Apr 28, 2020
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.0does not affect this issue.Additionally invoking
Start-PSBuildfails too unless a manual NuGet package restore is performed first withmsbuild -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-PSBuildhas suceeded previously.[-]Fails to build when targeting netcoreapp5.0 using Visual Studio 2019[/-][+]Failure to build when using Visual Studio 2019 without manual NuGet package restore[/+]TravisEz13 commentedon Apr 28, 2020
xtqqczze
Import-Module ./build.psm1; Start-PSBuildI 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.
vexx32 commentedon Apr 28, 2020
I've often found that in a clean workspace or after some commits have been pulled in I'll need to
Start-PSBuild -Cleanwhich prompts it to take a couple extra steps that seem to be required in certain cases.TravisEz13 commentedon Apr 28, 2020
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
-RestoreAllswitch tostart-psbuild.The
slnis 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,TypeGenwhich 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.
xtqqczze commentedon Apr 28, 2020
Rain Sallow (/u/ta11ow) (@vexx32) I have now found that if
Start-PSBuild -Cleanis used as you suggested thanmsbuild -t:restoreis unnecessary.Travis Plunk (@TravisEz13) It seems that if Visual Studio is opened before running
Start-PSBuildthen 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.xtqqczze commentedon Apr 28, 2020
To resolve this issue
Import-Module ./build.psm1; Start-PSBuild -Cleanshould be ran with Visual Studio closed. After building from the command line once, then "Build Solution" from within Visual Studio seems to work.iSazonov commentedon Apr 29, 2020
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)
TravisEz13 commentedon Apr 29, 2020
I don't want to move it but it would be required for msbuild or visual studio to work perfectly