MSBuild error MSB4184, The expression 'expression' cannot be evaluated - gitlab

After a server upgrade (and all of its software), I ended up with this error in my pipeline.
This error affect all of my projects (more than 100) in the same way after the server upgrade. All of these projects have the same yml script
The error comes from GitLab job log:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VisualStudio\v16.0\Web\Microsoft.Web.Publishing.targets(143,5): error MSB4184: non è possibile valutare l'espressione "[System.IO.Path]::GetExtension("Production - Web Deploy.pubxml")". Caratteri non validi nel percorso. [C:\gitlab-runner\builds\NcXd8-56\0\yourbiz\bizbraco-master\BizBraco\BizBraco.csproj]
I've tried to run my command
msbuild /m /nr:false /clp:Verbosity:minimal /p:DeployOnBuild=true /P:PublishProfile=$env:DEPLOY_PROD_PROFILE /p:Configuration=Release /p:Password=$env:DEPLOY_PROD_PWD
directly on server, but the server does not give me errors, and it's the same server used as Runner on Gitlab.
I know that there are few details, but I don't have any other specification.

Related

GenerateEFSQLScripts fails when trying to publish to IIS using Web Deploy from TeamCity

Running into a total dead-end here.
I've created a Publish Profile for a .net6 application that we want to publish to IIS with Web Deploy. In the Entity Framework Migration section, the option to "Apply this migration on publish" is selected.
When manually clicking publish, everything works. However, we want to automate this in TeamCity using the .NET build runner. The publish step fails at:
Generating Entity Framework SQL Scripts...
Executing command: dotnet ef migrations script --no-build --idempotent --configuration Release --output "C:\TeamCity\buildAgent\work\cbf95cc2b4413601\MySolution.Api\obj\Release\net6.0\PubTmp\EFSQLScripts\MySolution.Data.MyContext.sql" --context MySolution.Data.MyContext
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk.Publish\targets\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets(221,5): error : Entity Framework SQL Script generation failed
Internal error message details: BuildMessage1 0 Text DefaultMessage ERROR 400682522803500 tags:'tc:parseServiceMessagesInside'
Error message is logged
Build FAILED.
I cannot find any specific error messages anywhere in any log. Looking in the Microsoft.NET.Sdk.Publish.TransformFiles.targets file shows that it's failing on GenerateEFSQLScripts - an MSBuild command that executes dotnet ef under the covers.
I thought this might be a case of dotnet ef not being installed on the build agent. But when I manually run the command myself from C:\TeamCity\buildAgent\work\cbf95cc2b4413601\MySolution.Api, it succeeds, and the SQL scripts are successfully created.
I also thought it might just be a case of the command being run in the wrong directory (i.e. in the root MySolution folder rather than the MySolution.Api folder), but explicitly setting the working directly fails at the same point, with the same error.
Has anyone seen this before? Or could point me to where an actual error might be located?

Azure Function App - Publish failed

I'm unable to publish (WebDeploy) my Azure Function App (It's a Durable Function, I know it deosn't matter, but, just in case if matters). This started happening today.
I'm getting a "Publish Failed" popup and the below error message in the output window of my Visual Studio.
Error Message
<ProjectName> -> C:\search\source\<Solution Folder>\obj\Release\netstandard2.0\PubTmp\Out\
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Web deployment task failed. (Could not connect to the remote computer ("<functionappname>.scm.azurewebsites.net"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.) [<projectname>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : The requested resource does not exist, or the requested URL is incorrect. [<projectname>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Error details: [<projectname>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Could not connect to the remote computer ("<functionappname>.scm.azurewebsites.net"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE. [<projectname>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : The remote server returned an error: (404) Not Found. [<projectname>.csproj]
Publish failed to deploy.
Function Runtime - beta
When I access the Function App Url in a browser I get "Your Function App 2.0 preview is up and running" message". And, I don't see anything wrong in the Kudu portal as well.
I have deleted the Function and re-created it with the same name with no luck.
Any help is much appreciated.
Update : Here is another error that I'm getting as well.
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Web deployment task failed. ((7/25/2018 1:16:27 PM) An error occurred when the request was processed on the remote computer.) [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : (7/25/2018 1:16:27 PM) An error occurred when the request was processed on the remote computer. [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : An error was encountered when processing operation 'Create Directory' on 'D:\home\site\wwwroot\bin'. [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : The error code was 0x800703E6. [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Invalid access to memory location. [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath) [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : at Microsoft.Web.Deployment.FileSystemInfoEx.set_Attributes(FileAttributes value) [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : at Microsoft.Web.Deployment.DirPathProviderBase.Add(DeploymentObject source, Boolean whatIf) [<Project Name>.csproj]
Publish failed to deploy.
Thanks,
Praveen
I fixed this issue by setting WEBSITE_RUN_FROM_PACKAGE to 0 on the application settings. I was uploading the function files by syncing a WebDeploy package from Azure DevOps to the App Service file system and not running it from the .zip package.
On https://learn.microsoft.com/bs-cyrl-ba/azure/azure-functions/run-functions-from-deployment-package explains about running Functions from a deployment package and all the benefits of doing it this way, but then remember to:
Just upload the .zip deployment package to d:\home\data\sitepackages (don't use the msdeploy verb "sync" to sync the file system at wwwroot)
Add a packagename.txt containing only the name of the package file in folder, without any whitespace
Go to azure portal, stop the function app, publish from vs, then start again.
Don't know if this is closed but I had same issue while deploying new SDK version to an older azure function app. Here is what I did:
Instead of downloading deployment profile from Azure portal, created a new one with visual studio automated deployment.
This is important- While deploying from Visual studio it should ask you to upgrade version of deployed app, click yes and your app will get deployed.
Can't reproduce your error when using WebDeploy with SCM. When I set WEBSITE_WEBDEPLOY_USE_SCM to false(in Application settings) to avoid using SCM, I saw An error was encountered when processing operation 'Create Directory' on 'wwwroot' like the second error you have met.
Several options to try:
Visit https://functionappname.scm.azurewebsites.net in browser to check whether your network environment is fine and has no firewall restriction.
Check whether you have proxy set like Fiddler when publishing.
Go to portal, Reset publish credentials then Download publish profile. Delete old publish profiles and import the new one to publish again.
If all of those suggestions fail, delete all old resources relate to the function. Then create a brand new function app with new app service plan and storage. Try to publish to this new app.
This seems to happen to me when I have made changes that for some reason necessitate the following.
Rebuild the project (make sure you can run it locally).
Click to publish, but prior to that click on "Manage Application Settings" do
a quick check and click OK.
Attempt to publish.
If that fails close visual studio and azure portal (stop running or disable all relevant objects) and repeat.
Worst case create a new profile and deploy to that.
It was easy to miss for me...but the Function on Azure was blocking my publish from Visual Studio 2017.
What was needed was a restart of the Function on Azure.
1) Go to Azure Portal and click into your Function app.
2) Click on the name of your Function, and then in the Overview tab - in the second-row menu you should see Restart. (You'll see it in the row with: Stop - Swap - Restart - Get publish profile...etc.)
3) Click Restart
4) Go back to Visual Studio 2017 and Republish.
My error message which I initially missed:
C:\Program Files\dotnet\sdk\2.2.103\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): error : Web deployment task failed. (Web Deploy cannot modify the file 'MyApp.Functions.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.) [C:\Github\2019AzureBlobLocalOnly\MyApp.Functions\MyApp.Functions.csproj]
A similar issue to #Andrew Chung where there were locks on the files in Azure and it couldn't delete old function dll files. I was trying to upgrade to .NET core and publish from a different project. Unfortunately, i didn't see his response until it was too late, and had followed #Jerry Liu's advice (#4) to remove the function app and add in a new one. This didn't seem to work for me as until I recreated the app with a different name. I suspect there may be a DNS conflict where xxxx.scm.azurewebsites.net is still pointing to the IP address of your old decommissioned app.

CruiseControl.net Project Fails with no errors, how to identify error?

Had cruise control.net (v1.8.5.0) up and running for about 6 months on 4 projects, no issues.
In the past week or so, one project reports a failure... even though it compiles correctly and no unit test errors are reported as they were previously on failures. None of similiar reports on SO or elsewhere describe or correct this problem.
Here is dashboard status:
BluePrint Failure Breakers : support2 Failing Tasks : NUnitTask
In the build report log where it would normally show which tests failed, it shows no failures just the unit startup message:
ProcessModel: Default DomainUsage: Single Execution
Runtime: net-3.5
Normally here for an nunit error the erroring test #s and names that failed and the nunit assert failure message. In a passing situation it would display xml for each test.
Can someone point me somewhere else what might be causing this or where else I might look to find out why?
When I run nunit manually on the same tests the cruise control service has checked out the build server, everything works fine.
I've tried restarting both the cruise control service and IIS, same result.
When I look in the ccnet.log file on the server, it doesn't report anything more specific than whats already in the build log above:
Done Building Project
"C:\Users\j\Documents\CIWork\BluePrint\BluePrint.sln" (Build
target(s)).
Build succeeded.
0 Error(s)
Time Elapsed 00:00:13.99
2017-01-20 18:50:36,869 [BluePrint:DEBUG] Running unit tests:
C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe
/xml=C:\Users\j\Documents\CIWork\BluePrint\logs\LatestTests.BluePrint.xml
/nologo
C:\Users\j\Documents\CIWork\BluePrint\Tests\bin\x64\Release\TestBluePrint.exe
2017-01-20 18:50:36,869 [BluePrint:DEBUG] Starting process [C:\Program
Files (x86)\NUnit 2.6.3\bin\nunit-console.exe] in working directory
[C:\Program Files
(x86)\CruiseControl.NET\server\BluePrint\WorkingDirectory] with
arguments
[/xml=C:\Users\j\Documents\CIWork\BluePrint\logs\LatestTests.BluePrint.xml
/nologo
C:\Users\j\Documents\CIWork\BluePrint\Tests\bin\x64\Release\TestBluePrint.exe]
2017-01-20 18:50:36,953 [BluePrint:DEBUG] Not setting PriorityClass on
[C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe] to default
Normal 2017-01-20 18:50:37,686 [20:DEBUG] [BluePrint C:\Program Files
(x86)\NUnit 2.6.3\bin\nunit-console.exe] ProcessModel: Default
DomainUsage: Single 2017-01-20 18:50:37,686 [20:DEBUG] [BluePrint
C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe] Execution
Runtime: net-3.5
My configuration has not changed in 6months, here's the relevant task from ccnet.config:
<nunit>
<path>C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe</path>
<outputfile>C:\Users\j\Documents\CIWork\BluePrint\logs\LatestTests.BluePrint.xml</outputfile>
<assemblies>
<assembly>C:\Users\j\Documents\CIWork\BluePrint\Tests\bin\x64\Release\TestBluePrint.exe</assembly>
</assemblies>
</nunit>
As I was posting this I recalled that one of these tests downloaded a fair amount of data from internet and cached it. Running it from the console worked, but running it from system account as service must've been slower to exceeded default cruisecontrol timeout.
Weird that no timeout error was in the log. However copying the cached files from the admin account to systemprofile account fixed it. Will also see if the nunit test can be modified to automatically time itself out.

NET 5 MVC 6 - Publishing to Azure Websites ERROR_COULD_NOT_FIND_APPROOT_FOLDER

Just trying to publish a mvc 6 default template (web api) project to azure (importing publishing profile from the publishing wizard, info is correct but on preview or publish I receive :
ERROR_COULD_NOT_FIND_APPROOT_FOLDER
searching for the error on google gives me 0 results.
also the link provided by microsoft doesn't yet have this error documentation.
Not sure where to look. My project.json does have the appropiate webroot : wwwroot (as I said, no modification to the web site project)
It works locally, of course.
the complete error I'm receiving is :
1>------ Build started: Project: MayaKin.Web, Configuration: Release Any CPU ------
Inside GatherAllFilesToPublish
Environment variables:
Path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\\Extensions\Microsoft\Web Tools\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\\Extensions\Microsoft\Web Tools\External\git
C:\Users\Bart\.k\runtimes\kre-clr-win-x86.1.0.0-beta3-11030\bin\kpm.cmd bundle "C:\Bartmax\MayaKin\MayaKin\src\MayaKin.Web" --out "C:\Users\Bart\AppData\Local\Temp\AspNetPublish\MayaKin.Web-42" --configuration Release --runtime kre-coreclr-win-x64.1.0.0-beta3 --wwwroot-out "wwwroot" --quiet
1>
1> Build succeeded.
1> 0 Warning(s).
1> 0 Error(s).
1>
1> Time elapsed 00:00:00.0860073
1>
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
Time elapsed 00:00:00.4172004
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.AspNet.Publishing.targets(205,5): Error ERROR_COULD_NOT_FIND_APPROOT_FOLDER: Web deployment task failed. (Could not map the path 'MayaKin__Staging' to an approot folder. Make sure the relative path you specify points to the root of an application.
Obtenga más información en: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_FIND_APPROOT_FOLDER.)
Publish failed to deploy.
This has been fixed. You can follow the issue on github.
https://github.com/aspnet/Tooling/issues/15

Can't get azure web role to run locally using the emulator

I have a web role that I'm trying to run locally using the emulator. I have it working on another computer, but I cannot get it working on a different one, and have gone as far as to reformat it and start from scratch.
When I launch the site from Visual Studio, Chrome shows the following message:
This webpage is not available
The connection to 127.0.0.1 was interrupted.
There is also an error code listed at the bottom:
Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
One interesting thing from the build output are these lines:
Starting process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' with arguments '"C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web"'...
Process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' exited with exit code 0.
If I run C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web" from the command line, I get the following message:
The system cannot find the file specified.
Unable to start IIS Express in background.
I have no idea what file it cannot find, but I've verified that the config file I'm passing does in fact exist. Anyone have a clue what's going on here??
While I can not tell you what could be the actual root cause of your problem I can suggest a few ways to troubleshoot it:
Try changing IIS Express to Full IIS and see if it changes the behavior. You can do it by going to your Windows Azure Application project properties and look at "Web" option.
Try running application without debugging it
Launch CSrun at command prompt with /launchDebugger parameter of the /run option to verify that debugger does run without any issue
Try using IE as default browser
Clean your dftemp folder completely for any residual configuration and then launch Azure Emulator separately to verify there are no issues
Procmon "http://technet.microsoft.com/en-us/sysinternals/bb896645" may help you find the file that is missing...
Hopefully someone stumbles upon this answer with similar symptoms. When removing in role caching the <dataCacheClients> section was removed from . Somehow there was a left over <dataCacheClients> section left in the web.config. Everything and compiled and deployed to the emulator successfully. However, the role would fail to start since applicationHost.config was missing.
The fix was simply remove the unnecessary <dataCacheClients> section from the web.config file.

Resources