VS 2013 Azure Publish hangs with last Pubxml file - azure

If I publish to Azure Cloud Service using the Cloud Project and follow the publish wizard from it works fine but only if I delete the last Pubxml file (stored in the profile folder) first.
If I try and publish when a Pubxml file already exists it will hang trying to navigate between wizard steps.
Using SDK V2.9.6, although had the same issue on previous versions.
I have multiple subscriptions, and the issue seems to be whilst the Pubxml does store the subscription, it is ignored and the default (first one in the list alphabetically) is used instead.
So if I run a publish where there was a previous Pubxml, it jumps to the Diagnostics page. I click next for the summary and the issue areas are highlighted with a red error indicator (it has the wrong subscription selected by default, and hence it cannot find the correct cloud service). However I cannot click back as it just hangs.

I'm using SDK V2.9.6, and didn't see this problem. Actually, my pubxml files have subscription information included.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AzureCredentials>{"ServiceManagementEndpoint":"https:\/\/management.core.windows.net\/","ResourceManagementEndpoint":"https:\/\/management.azure.com\/","SubscriptionId":"my-subscription-id"}</AzureCredentials>
...
</PropertyGroup>
</Project>
Which version of Azure SDK is your pubxml files generated from?

Related

Unable to publish customization from Customization Project Browser screen

I am having a weird case where I am unable to publish customization from Customization Project Browser. Whenever I click on Publish Current Project menu item from Publish menu, it opens up Compilation immediate window with Publish Customization heading but then it just stuck there with no further process.
But, I can publish the same project from Customization Projects Screen where I select the Customization Project with checkbox and click on Publish action icon.
Currently, that's the workaround I am using to publish but is there any other way that I can do to fix this issue?
I have cleaned up ASP.NET Temporary Files and Acumatica's Apply Updates.
Thanks.
that's due to some update in .net framework.
the solution is to update acumaticaERP to the latest, or do some workaround.
publish from custom project form
edit web.config and add <add key="aspnet:DisableAppPathModifier" value="false" /> to appSettings
https://community.acumatica.com/customization-and-development-72/after-the-installation-of-the-2020-10-cumulative-update-for-net-framework-3-5-and-4-8-users-were-unable-to-publish-a-customization-project-from-the-customization-project-editor-3854
I discovered the reason for this strange behavior, as well as the solution. It happened to me as well.
Reason: the w3wp process encounters an error during publishing. The folder permissions for c:\Program Files\Acumatica ERP\TemporaryAspFiles[yourAppName]
have been removed or deleted for the speficic windows account, which is used by the ERP, and the temporary sub-folders can't be created without create permission. I can't see how it happened, but I noticed the strange behavior occurred after the last "major" windows update. See the screenshot for the proof.
Solution: re-apply the user account security for your application folder. That is how I fixed the publish problem on my end.

EscapeTextForRegularExpressions error while webdeploying to azure

In my asp.ent MVC4 project, I am using webdeploy to deploy to azure and I deployed this project to the app service on azure several times before. but out of a sudden I have this error.
"EscapeTextForRegularExpressions" task was not given a value for the required parameter "Text"
I Have found an answer:
Add this file into the web project in its root folder.
File Name : *.wpp.targets
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ExcludeFromPackageFolders Include="Internal">
<FromTarget>*.wpp.targets</FromTarget>
</ExcludeFromPackageFolders>
</ItemGroup>
</Project>
Never the less I cannot understand the real cause of the problem
According to your description, I found a similar issue noted the IncludeIisSettings within *.csproj. Per my test, if I specified the <IncludeIisSettings>true</IncludeIisSettings> with my csproj, then when I use the Web Deploy method from the Publish wizard of VS, I could encounter the similar issue as follows:
After remove the IncludeIisSettings or set the value to false, then I could deploy my web application to azure web app successfully.
I have another answer maybe can help someone:
You must open the Solution explorer then right-click the project, select properties, on Package/Publish Web check your Configuration is on Release and not on Active (Debug) in the drop-down, this was the solution in my case.

Error WAT200: No default service configuration "ServiceConfiguration.cscfg" could be found in the project

After installing Visual Studio Enterprise 2017 (Version 15.1 (26403.7)) my Azure Cloud Service does no longer build and gives me the 'Error WAT200: No default service configuration "ServiceConfiguration.cscfg" could be found in the project'. Although it still works fine with Visual Studio Enterprise 2015. (The right TargetProfile is also specified...)
I ran into this last night.
It actually happens when you rename Cloud Service configurations away from Cloud and Local.
In my case, I had deleted the Cloud configuration and created a new, differently named one.
By ensuring that the configurations are called Cloud and Local, the Cloud Service projects will build again using "Resharper build", and (most likely) under "Lightweight solution load".
The configurations can be renamed by right-clicking one of the service roles under the Cloud Service node in Solution Explorer, choosing Properties, then opening up the "Service Configuration" dropdown and clicking <Manage...>.
Now, in the resulting dialog, the configurations can be renamed:
The following bug report got me on the right track:
https://youtrack.jetbrains.com/issue/RSRP-450390
The best way is to change the service configuration prefix in ccproj of your project, add yourprojectname.configurationname
Dot is the life saver.
<ServiceConfigurationPrefix>yourproject.ServiceConfiguration</ServiceConfigurationPrefix>
Add these in itemgroup:
<ServiceDefinition Include="yourproject.ServiceDefinition.csdef" />
<ServiceConfiguration Include="yourproject.ServiceConfiguration.cscfg" />
Make sure you have renamed your cscfg files from the folder it resides.
Reload
Bingo. It works.
Ok I found it, after disabling the 'Lightweight Solution Load' (which in VS 2017 u can disable by right click on the Solution and then Disable Lightweight Solution Load), the error disappears and the Cloud Service builds again.
Similar to Rishikesh mentioned, but I added a service config entry
<ServiceConfiguration Include="ServiceConfiguration.cscfg" />
to the ccproj. Then copied a configuration, e.g. Production and named it ServiceConfiguration.cscfg. Then reloaded the project. That got the ReSharper to build, but MORE importantly for me at the moment was to figure out how to the get Azure DevOps pipeline to build the solution with multiple Classic WebRole projects in it. That was failing for the SAME reason.

Asp.Net EF Code First continuous integration with VSTS - Azure Sql Db not deploying

I am having trouble getting migrations to run to create / update my Sql Db hosted on Azure. They run fine locally to my LocalDb but seem to be completely ignored when releasing to Azure.
Details:
- Asp.Net MVC 5.2.3
- Entity Framework 6.1.3
- Visual Studio Team Services (online)
- Azure Web App & Azure SQL Db (under Imagine / Dreamspark subscription)
I created a different application that didn't use CI, but used the Publish feature within Visual Studio and it published fine and worked. I have since removed that web app & db from Azure since the subscription only allows one db.
I'm thinking it may be something I'm missing in setting up the build definition in VSTS, I'm just not sure what.
I have tried:
https://blogs.msdn.microsoft.com/webdev/2014/04/08/ef-code-first-migrations-deployment-to-an-azure-cloud-service/ (this did nothing for me)
https://www.benday.com/2016/11/07/using-tfs-build-to-deploy-entity-framework-database-migrations-with-migrate-exe/ (I received a build error that I didn't have a release definition in my bin folder)
... as well as a bunch of others (I don't have the windows open any longer or I'd link them too).
My current build steps include:
NuGet restore - NuGet Installer
Build solution - Visual Studio Build
Test Assemblies - Visual Studio Test
Publish symbols path - Index Sources & Publish Symbols
Publish Artifact - Publish Build Artifacts
In my local env, EF works when I Enable-Migrations, Add-Migration, Update-Database. I'm guessing none of the above steps do this so I need one or more steps. Ben Day's blog seems like it should work, but for some reason, it's not finding my bin/release file.
The actual application deploys to Azure just fine upon release of the above successful build definition. It's just that the database is completely ignored. Using SSMS, I check the Azure db, and while it exists, it has none of my tables or data.
What am I missing?
Thanks.
**Edit - found the simple item I was missing. I need to add the connection string for the db to the web app in Azure. It now has my initial tables, and stores data using those tables, but doesn't pick up migrations. So something I've done in the last two days got my initial tables out there. Now.. to remember what it was.
**2nd Edit - So, I think the tables made it into the release db before I fixed my connection string in VSTS. One of the things I tried was creating a separate database project. I think when I pushed that at some point, the tables in existence at that time also pushed to release, I just couldn't see them because I hadn't connected the application and db together? At any rate, EF migrations are still not being recognized. I tried Ben Day's suggestion again, but I"m getting the build error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
I am using EF 6.1.3
I ran into this as well. I was using Visual Studio to publish my Azure app service. After doing some research (https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application#deploy-to-azure), I came to learn that VS Publish transforms your web config when you check the box for "Update Database" in Publish setting, adding a connection string that refers to the database containing your _migrations table, as well as a "contexts" element under "entityFramework". You can see what a previous publish has done with your web.config by looking at "..obj\Release\InsertEFCodeFirstDeploy\transformed\web.config".
So to recreate this same action when using a build and release definition in VSTS, I added 2 XDT "insert" transforms in Web.Release.config in my service project. Mine looks like this:
<?xml version="1.0"?>
<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MS_TableConnectionString_DatabasePublish" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=AzureStorageEmulatorDb45;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True"
providerName="System.Data.SqlClient" xdt:Transform="Insert" />
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
<entityFramework>
<contexts xdt:Transform="Insert">
<context type="helpmeshopService.Models.helpmeshopContext, helpmeshopService">
<databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[helpmeshopService.Models.helpmeshopContext, helpmeshopService], [helpmeshopService.Migrations.Configuration, helpmeshopService]], EntityFramework, PublicKeyToken=b77a5c561934e089">
<parameters>
<parameter value="MS_TableConnectionString_DatabasePublish" />
</parameters>
</databaseInitializer>
</context>
</contexts>
</entityFramework>
</configuration>
Next, you will need to go to your App Service "Application Settings" in the Azure portal and add a connection string with name, "MS_TableConnectionString_DatabasePublish", and set its value to the same value as for "MS_TableConnectionString" that should already exist in your settings.

How to specify database for Database Project and deploy?

I created a Database Project in VS 2012, but how do I specify a database connection for it so that it uses the database context for Intellisense tips and for deployment?
Also, to deploy to the target database, have I call Publish all the time, or can it be done on each build?
Intellisense does not use a connection string to function, it uses the objects (table, views, column, etc) defined in your project.
For deployment, this is done through publishing. You can right-click your project and select Publish... and this will open the Publish Database popup. From there, you use profiles to deploy to the right database with the correct settings.
Once you have profiles created, they will appear as file in your project, you can then double-click those and then publish your database using that profile.
As for publishing each time you build the project, I never tried it, but this can probably be accomplished by changing the targets your project use building. By default, your project looks like this:
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0">
Try changing this to
<Project DefaultTargets="Build;Publish"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0">

Resources