Visual Studio deployment doesn't activate SharePoint feature - sharepoint

I have a simple SharePoint project with one farm-scoped feature. The feature contains no modules; it just refers to an SPClaimProviderFeatureReceiver-derived class which in turn points to an SPClaimProvider-derived class.
When I tell the project to deploy, it does successfully add the assembly to the GAC, and does successfully create Feature.xml within a folder in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES, and gives this output:
------ Build started: Project: xxx, Configuration: Debug Any CPU ------
xxx -> E:\xxx\bin\AnyCPU\Debug\xxx.dll
Successfully created package at: E:\xxx\xxx.wsp
------ Deploy started: Project: xxx, Configuration: Debug Any CPU ------
Active Deployment Configuration: Default
Run Pre-Deployment Command:
Skipping deployment step because a pre-deployment command is not specified.
Recycle IIS Application Pool:
Skipping application pool recycle because no matching package on the server was found.
Retract Solution:
Skipping package retraction because no matching package on the server was found.
Add Solution:
Adding solution 'xxx.wsp'...
Deploying solution 'xxx.wsp'...
Activate Features:
No features in this solution were activated.
Run Post-Deployment Command:
Skipping deployment step because a post-deployment command is not specified.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
The deployed Feature.xml:
<?xml version="1.0" encoding="utf-8"?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Title="xxx"
AutoActivateInCentralAdmin="TRUE"
Description="xxx"
Id="063aae98-029f-4c01-a20e-15b6c8576bc8"
ReceiverAssembly="xxx, Version=0.1.0.0, Culture=neutral, PublicKeyToken=6e7f8ba8e1265a7f"
ReceiverClass="xxx" Scope="Farm" />
I'm concerned that it says that no features were activated. The WSP does show up in Central Administration Solution Management, but says that it "isn't deployed", and the feature doesn't show up in Manage Farm Features. When I click on Deploy in the web interface, it says "The solution was successfully deployed" (Why didn't VS do this??). But after that the feature still doesn't show up.

In VS solution explorer, right click on project >> select properties >> select sharepoint tab
Here you have different 'Active deployment configuration'. make sure you have selected appropriate configuration from drop down list. you can modify and view steps of each configuration.

If you get this kind of error while deploying your solutions to sharepoint environment, ensure that your project is not a sandboxed solution.
Click on your project, go to properties window in Visual Studio and change the value of Sandboxed Solution from true to false. Rebuild your project and deploy.

skipping pre and post deployment command is only a warning because you haven't specified any command for these steps.
in VS SharePoint tab (see Rahil answer on how to get there), you have 2 text boxes for writing your pre and post commands

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?

Publish Failed Error while publishing Azure functions on azure

I am getting error while publishing azure functions on azure portal.I tried lot of things and visited lot of links but didn't find any suitable soltuion.
Below is the output in output window.
Azure Application Settings updated.
1>------ Build started: Project: AwepayReconcile.DAL, Configuration: Release Any CPU ------
1>Models\AwepayContext.cs(26,10,26,214): warning CS1030: #warning: 'To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.'
1>AwepayReconcile.DAL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DAL\bin\Release\netcoreapp2.1\AwepayReconcile.DAL.dll
1>Done building project "AwepayReconcile.DAL.csproj".
2>------ Build started: Project: AwepayReconcile.DL, Configuration: Release Any CPU ------
2>Infrastructure\Extensions.cs(34,42,34,44): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(177,36,177,38): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(210,36,210,38): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(304,30,304,32): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(403,30,403,32): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(40,36,40,42): warning CS0169: The field 'ReconcileService.hssfwb' is never used
2>Services\ReconcileService.cs(38,33,38,38): warning CS0169: The field 'ReconcileService.sheet' is never used
2>Services\AzureBlobStorageService.cs(29,29,29,41): warning CS0414: The field 'AzureBlobStorageService._appSettings' is assigned but its value is never used
2>AwepayReconcile.DL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DL\bin\Release\netcoreapp2.1\AwepayReconcile.DL.dll
2>Done building project "AwepayReconcile.DL.csproj".
3>------ Build started: Project: AwepayReconcile.AzureFunctionsApp, Configuration: Release Any CPU ------
3>AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\bin\Release\netcoreapp2.1\bin\AwepayReconcile.AzureFunctionsApp.dll
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Publish Started
AwepayReconcile.DAL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DAL\bin\Release\netcoreapp2.1\AwepayReconcile.DAL.dll
AwepayReconcile.DL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DL\bin\Release\netcoreapp2.1\AwepayReconcile.DL.dll
AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\bin\Release\netcoreapp2.1\bin\AwepayReconcile.AzureFunctionsApp.dll
AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\obj\Release\netcoreapp2.1\PubTmp\Out\
Publishing D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\obj\Release\netcoreapp2.1\PubTmp\AwepayReconcile.AzureFunctionsApp - 20190320182641787.zip to https://awepayreconcileazurefunctionsapp20190320061400.scm.azurewebsites.net/api/zipdeploy...
C:\Users\tejinder.s\.nuget\packages\microsoft.net.sdk.functions\1.0.26\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Publish.ZipDeploy.targets(42,5): error : The attempt to publish the ZIP file through https://awepayreconcileazurefunctionsapp20190320061400.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code RequestTimeout. [D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp.csproj]
Please help me to git rid of this.
Thanks
When deploying your function app to Windows, you should set WEBSITE_RUN_FROM_PACKAGE to 1 and publish with zip deployment.
Zip deployment is a feature of Azure App Service that lets you deploy your function app project to the wwwroot directory. The project is packaged as a .zip deployment file. The same APIs can be used to deploy your package to the d:\home\data\SitePackages folder.
With the WEBSITE_RUN_FROM_PACKAGE app setting value of 1, the zip deployment APIs copy your package to the d:\home\data\SitePackages folder instead of extracting the files to d:\home\site\wwwroot. It also creates the packagename.txt file. The function app is then run from the package after a restart, and wwwroot becomes read-only.
For more details, you could refer to this article.

Unable to publish node.js app from VS2015 using VS publish

I’ve got a node.js project which I’m using to publish to Azure. This worked fine the first couple of times I’ve published, but now when I try and publish it just fails with no error message. The output in the Azure Service Activity window in VS2015 is simply:
Auto ConnectionString Transformed Web.config into obj\Release\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
And the output from the ouput/build window is:
------ Publish started: Project: node, Configuration: Release Any CPU ------
Auto ConnectionString Transformed Web.config into obj\Release\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
I don’t really know where to start diagnosing this as there is no error message per se.
Things I’ve tried thus far:
Full Clean and/or rebuild
Deleted all folders from the BIN directory
Deleted all folders from the obj directory
Tried both debug and release configurations
Deleting the publish profile from VS and re-adding it from scratch
None of the above has made any difference
Has anyone seen this issue before or could suggest where to start diagnosing the cause?
Thanks
Do you happen to have GhostDoc installed?
Uninstalling it fixed it for me after seeing this issue.
I had the same issue, and it was due to file paths getting long more than the allowed number of characters. use this module to make your file paths shorter, and it will fix this issue
https://www.npmjs.com/package/flatten-packages

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

TeamCity ".Net Process Runner" hangs

We have started migrating our one of several projects to team city as part of CI. Below is how we have setup teamcity build. We are trying to deploy WebSite.
1) Build Step 1 (Package installation)
Using "command line " runner type install required package.
2) Build Step 2 (Build)
Using Runner type "Visual Studio (sln)" (Visual Studio 2010) build website.
3) Build Step 3 (Deploy Web Site)
Using ".Net Process Runner", deployer.exe (x86 built with .Net Framework 4) deploy site.
Deployer.exe reads config file. Config file contains "BuildId", "Environment" and "Servers" where we want build to be pushed.
<buildType id="bt52">
<env name="Debug">
<server path="SERVER1" />
</env>
<env name="QA">
<server path="SERVER2" />
<server path="SERVER3" />
</env>
<env name="UAT">
<server path="SERVER4" />
<server path="SERVER5" />
</env>
</buildType>
Deployer.exe is called with required parameters as below. Which reads config and deploys site to Server2 and Server3.
Deployer.exe "bt52" "QA" "siteQA" "E:\BuildAgent\work\2483052e33e5e1e8\src\diy\" msdeploy.exe
Problem area is step #3.
When we run deployer.exe using .Net process runner as part of team city we see its hanging and not responsind sometime even for 45 minutes. When we try to execute same deployer.exe from build server using command line script executes within couple of seconds.
E:\TeamCity_custom_applications\deployer>Deployer.exe farm1-1 QA siteQA E:\BuildAgent\work\2483052e33e5e1e8\src\diy\ msdeploy.exe
Info
: Processing batch run ... Info : Processing command ...msdeploy.exe
-verb:sync -source:contentPath="E:\BuildAgent\work\2483052e33e5e1e8\src\diy\" -dest:contentPath="siteQA",wmsvc="SERVER2",userName="*****",password="******",authType="Basic"-skip:objectName=filePath,absolutePath=web.config -skip:objectName=dirPath,absolutePath="bin" -enableRule:DoNotDeleteRule -allowUntrusted Info : output >>Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters changed, 0
bytes copied) Info : error >>(none) Info : ExitCode >> 0 Info :
Processing command ...msdeploy.exe -verb:sync
-source:contentPath="E:\BuildAgent\work\2483052e33e5e1e8\src\diy\" -dest:contentPath="siteQA",wmsvc="SERVER3",userName="******",password="******",authType="Basic"
-skip:objectName=filePath,absolutePath=web.config -skip:objectName=dirPath,absolutePath="bin" -enableRule:DoNotDeleteRule -allowUntrusted Info : output >>Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters ch anged, 0
bytes copied) Info : error >>(none) Info : ExitCode >> 0
Info: Deploy Script Complete.
One more thing we observed is running deployer.exe through teamcity I see that site content gets copied but only for 1 server and teamcity build status stays in "Running" mode. I am wondering if someone can please put little bit of insight on how can I look into this issue.
Update 1:
Thanks for your time looking into it !! What we ended up doing is, Instead of running command "msdeploy.exe" from "cmd.exe" we added "msdeploy.exe" location as Environment variable and executed "msdeploy.exe" in loop for # of servers. This has resolved issue of hanging. Now I am just curious to know why would it behave in such manner where if you execute "msdeploy.exe" from "cmd.exe" it would hang while running directly "msdeploy.exe" it would execute successfully. Any insight into same would be greatly appreciated.
Update 2:
I have added image which explains behavior using process explorer. If we kill msdeploy.exe from process explorer than for next all deployments to that server will not have the issue of build hanging. Please see below image
To be honest, it sounds like you're running into issues with redirecting input/output streams. TeamCity is running your application in a totally headless environment and then you, in turn, are attempting to redirect and parse the output of msdeploy.exe
If that's the case, I'd recommend looking into using the MSDeploy API instead of msdeploy.exe. The latter is just a command line wrapper for the former, so all the functionality is available to you. There's a sample deployment application available on the IIS blog if you need help getting started.
It seems you have NUnit build step configured in TeamCity and invoke cmd.exe from your test. This looks like an issue with the test code then. Most probably it will reproduce without TeamCity if you run the test in question with NUnit directly.
As Richard noted, most probably the issue root cause is related to stdin/stdout processing.
If you want to fix it in your code, you can try to experiment by explicitly closing stdin or the other way around, try writing something into it, etc.
Work around we did is, we observed msdeploy doesn't take more than 3-5 seconds to execute and deploy (Even for our biggest project which is almost 300mb website). So we set timeout of 20 seconds. So far since last 1 weeks we have not seen any issue with it and hopefully it will not cause more trouble but still we are not sure why such behavior.

Resources