umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.4k stars 2.66k forks source link

Cannot build v8 without error #7154

Closed idseefeld closed 4 years ago

idseefeld commented 4 years ago

I found closed issue #4861 which reported similar error during build solution.

My System: Windows 10 Pro (Build: 18363.476) Visual Studio 2019 - Version 16.3.9

node -v v12.13.0 gulp -v CLI version 2.0.1 npm -v 6.8.0

My steps:

  1. cloned Umbraco-CMS Branch: v8/dev from https://github.com/umbraco/Umbraco-CMS.git

  2. opened ..\Umbraco-CMS\src\umbraco.sln

  3. In VS toggle \Build folder and form context menu of build.ps1 selected: open with Powershell ISE then hit F5 (run script) result:

    
    PS C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build> C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build\build.ps1
    Die Datei "C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build\build.ps1" kann nicht geladen werden, da die Ausführung von Skripts auf diesem System 
    deaktiviert ist. Weitere Informationen finden Sie unter "about_Execution_Policies" (https:/go.microsoft.com/fwlink/?LinkID=135170).
    + CategoryInfo          : Sicherheitsfehler: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess

PS C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build>


4. Opened Powershell as admin and executed:
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

5. Again: In VS toggle \Build folder and form context menu of build.ps1 selected: open with Powershell ISE
then hit F5 (run script)
**_NEW result:_**

PS C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build> C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build\build.ps1 Download NuGet... nuget.exe : Unable to find package 'Umbraco.Build' In C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build\build-bootstrap.ps1:65 Zeichen:5

Failed to download Umbraco.Build. In C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build\build-bootstrap.ps1:66 Zeichen:20

PS C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build>


6. In VS Solution Explorer: context menu of Solution 'umbraco': Restore NuGet Packages

7. Again: In VS toggle \Build folder and form context menu of build.ps1 selected: open with Powershell ISE
then hit F5 (run script)
**_Result:_**

PS C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build> C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build\build.ps1 nuget.exe : Unable to find package 'Umbraco.Build' In C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build\build-bootstrap.ps1:65 Zeichen:5

Failed to download Umbraco.Build. In C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build\build-bootstrap.ps1:66 Zeichen:20

PS C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\build>

8. In VS I simply executed **Build Solution** from _Build_ menu and Error List shows:

Severity Code Description Project File Line Suppression State Error The command "powershell -ExecutionPolicy RemoteSigned -Command "&{ $ubuild = &"$pwd\build\build.ps1" -get ; $ubuild.CompileBelle() }"" exited with code 1. Umbraco.Web.UI C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj 408 Error CS0006 Metadata file 'C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\src\Umbraco.Web.UI\bin\Umbraco.Web.UI.dll' could not be found Umbraco.Tests.Benchmarks C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS\src\Umbraco.Tests.Benchmarks\CSC 1 Active

nul800sebastiaan commented 4 years ago

Thanks for the detailed report @idseefeld - could it be that you have NuGet sources configured that interfere with the build? @JeffreyPerplex has a PR open to fix this https://github.com/umbraco/Umbraco-CMS/pull/7089

As a tip: you are not required to use build.ps1, you can also build the solution in visual studio and do the gulp bits in whatever thing you like best (VS Code can run it if you open the Umbraco.Web.UI.Client directory for example, or the Task Runner Explorer in Visual Studio could do it, there's a few different ways).

idseefeld commented 4 years ago

Hi Sebastiaan, I hope you had just a sleepless night and this are not your regular business times;-)

There was no nuget issue like Jeffrey reported involved. Just to be clear I refer to untouched fresh official umbraco/umbraco-cms v8/dev branch. I pulled the latest v8/dev branch at 2019-11-15 09:30: Bump version o 8.6 (8.5 reserved for MB release)

I tried VS Code for the Client project. Fist npm install, then npm run build and it worked without an error. Last line of the quite long build report:

... 
PhantomJS 2.1.1 (Windows 8.0.0): Executed 171 of 171 SUCCESS (1.4 secs / 1.334 secs)
TOTAL: 171 SUCCESS

But I have noticed one (or two) possible issue(s):

  1. According to the npm install result message 21 vulnerabilities at high level:
    added 1801 packages from 1710 contributors and audited 29772 packages in 52.541s
    found 22 vulnerabilities (1 low, 21 high)
    run `npm audit fix` to fix them, or `npm audit` for details

    2. During build the Windows firewall alerted for Node.js in public networks although I am in my company domain network and I have switched firewall off for domain and private networks. But this might be just a Windows or personal configuration issue.

Finally I opened the ..\src\umbraco.sln in Visual Studio and just choose the regular Build Solution command from Build menu => Build succeeded At last I switched to Release configuration and build solution again => Build succeeded

Now I cleaned up my local branch by deleting all untracked files, especially the ones in Web.Ui project which are generated by the npm run build of Client project. And executed the Build Solution command in Visual Studio => same issue :-(

For now I think it will be helpful to update the documentation: https://github.com/umbraco/Umbraco-CMS/blob/v8/dev/.github/CONTRIBUTING.md

I can do that over the weekend.

Nevertheless someone should review the build-scripts. I am not experienced with these, but I will give Jeffreys PR a try...

Yours Dirk

idseefeld commented 4 years ago

Just an idea - a colleague remembered some changes in Microsoft's way how solutions deal with NuGet packages. Especially when it comes to copy files from one project to another (which npm run build in Client does). Does this ring a bell? Maybe for @zpqrtbnk

I'll do some research over the weekend...

zpqrtbnk commented 4 years ago

Can you fire the powershell command line, change directory to your solution's root, and run the build script:

PS> cd C:\Users\D.Seefeld\source\repos\UMB-forks\umbraco\Umbraco-CMS
PS> build/build.ps1

and report?

Is there a NuGet.config file in that solution's root, and what does it contain?

You should not worry too much about having Node etc. installed: the build script downloads copies of everything it needs, before building.

That is, assuming it can find what it needs. In your case, it cannot find the Umbraco.Build package, available on the umbracocore feed on MyGet. That feed is listed in the NuGet.config file that comes in the CMS repo.

So the question would be... why won't NuGet find it?

idseefeld commented 4 years ago

Hi Stephan, this time the build of a fresh clone run successfully: image

With another fresh clone Visual Studio menu build command run successfully too!!!

If there was no relevant update to the repository within the last three days, I have no idea what might have cause the issue. Well today I have updated Windows to this weeks patches before I run the builds.

Let's in the end assume there was a temporary external influence(?)

I wish you a nice weekend!

Yours Dirk