Visual Studio Team Services release XML transformation doesn't work - azure-pipelines-release-pipeline

Visual Studio Team Services - Build & Release
In the release definition, under File Transforms & Variable Substitution Options, there are XML transformation, and XML variable substitution.
I checked both checkboxes, but after deployment, nothing in my Web.Dev.config replaces web.config. The transformation doesn't happen at all.
What is the problem?
--------edit: detail---------
build
all the settings here is default.
release
web.dev.config
This transformation works fine if I deploy from visual studio 2015.
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="DefaultConnection" connectionString="Server=tcp:xxxx.database.windows.net,1433;Database=xxxx;User ID=xxx#xxx;Password=xxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
<add name="NicoContext" connectionString="metadata=res://*/Nico.csdl|res://*/Nico.ssdl|res://*/Nico.msl;provider=System.Data.SqlClient;provider connection string="data source=tcp:xxxx.database.windows.net,1433;initial catalog=xxxx;User Id=xxxx#xxxx;Password=xxxx;App=EntityFramework"" providerName="System.Data.EntityClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
<appSettings>
<add key="Environment" value="Dev" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="AzureStorageContainerName" value="xxx" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
<add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxx;EndpointSuffix=core.windows.net" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
<add key="FacebookLoginAppId" value="xxx" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="FacebookLoginAppSecret" value="xxx" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
</configuration>
--------edit 2: no longer work ---------
I did as the solution suggested on a new project in another Azure account, but this time it didn't work. For build, I choose template "Asp.net (preview)", for release, I choose template "Azure App Service Deployment".
--------edit 3: Release - Package or folder ---------

You have already deployed/published the web app, so the web.config has already been transformed (For web package deployment, the related values in web.config will be updated during web deploy, the values are in parameters.xml).
So, there isn’t other config files (e..g web.dev.config, web.release.config) in published folder and check XML transformation and XML variable substitution is useless.
Based on the build log, the web app build with release configuration, but there isn’t web.release.config, so there isn’t update for web.config.
You can refer to these steps to achieve your requirement:
Publish/deploy the web app with File System way (e.g. /p:WebPublishMethod=FileSystem /p:publishUrl= $(build.artifactstagingdirectory)\)
Add Copy file step copy others config files (web.dev.config, web.prod.config etc) to the published folder (artifact directory)
Add Publish Build Artifacts
For release, uncheck Publish using Web Deploy option and specify $(System.DefaultWorkingDirectory) to Package or folder.

Related

How to set NuGet environment variable NUGET_CERT_REVOCATION_MODE` to false on appcenter.ms

I am working on Xamarin.Forms app that is using a private NuGet feed.
For iOS building, I use appcenter.ms that is recommended by Microsoft. I have set up the NuGet restore step via API key by adding Nuget.config next to .sln file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="DevOps" value="https://xxx.pkgs.visualstudio.com/_packaging/xxx/nuget/v3/index.json" />
</packageSources>
<apikeys>
<add key="https://xxx.pkgs.visualstudio.com/_packaging/xxx/nuget/v3/index.json" value="%encrypted_api_key%" />
</apikeys>
</configuration>
However, nuget restore on appcenter.ms takes so long that build times-out after 30 minutes.
I suspect that issue is the Revocation check mode
I would need to set the NUGET_CERT_REVOCATION_MODE to false.
How to set NuGet environment variable NUGET_CERT_REVOCATION_MODE to false on appcenter.ms? or disable it some other way?

Cannot connect to mysql from visual studio 2015

So I have already spent about 2 days trying fix this. I have succeeded in fixing this on my workplace pc and can't get it to work on my home pc. I have read about a dozen SO articles and oracle forums articles and whatnot but still it does not work.
I have 1.2.4 msql for visual studio which is supposed to be a release which works on vs2015. I have installed mysql connector 6.8.6 and have first tried to add mysql to my project via nuget but after not being able to find a 6.8.6 version (there are 6.8.3 and 6.9.7 for one package and then again something else for the other...) I have referenced to my C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.6\Assemblies\v4.5 and have taken the 4 files there and have copied them ove the whole fkin computer. I have pasted it like everywhere. The vs2013 private assembly, my packages folder which I do not even reference to anyway and I think some vs2015 folder. I have ran a search for Mysql.Data and have pasted these files in every folder that came up as a result. I have rebuilt the solution for about 100-200 times and have cried for at least 20 minutes.
What do I have to do to get my new ADO.Net Entity Data Model generated?
I keep getting this stupid
image and I have really absolutely no idea what to do next. I just want to code but every time I start doing something I keep wasting days on tools not working. Do I really have to code in notepad so that I am sure it's my fault that something isn't working?
This is my app.Config file. I do not have anything else in my project.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v12.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.8.6.0" newVersion="6.8.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<connectionStrings>
<add name="KPlusConnectionString" connectionString="server=dito.ninja;user id=xxx;password=xxx;database=xxx" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
</configuration>
In order for VS 2015 to connect to MySql you need to be using a later version of the MySql libraries. While that seems like a pretty simple answer, in all honesty I have run into several problems along the way. With that in mind I am going to write out the 1 process that has consistently worked for me as far as getting EF working with MySql and VS2015. So, without further ado, here are the steps I have been taking in order to get this to work.
1) Make sure the MySql connector installation is updated
2) Create your web project
3) Open Nuget
4) Install Entity Framework
5) Search for MySql
6) Install MySql.Data
7) Install MySql.Data.Entity
8) Install MySql.Data.Entities
9) Install MySql.Web
10) Go to the references for the project and delete MySql.Data.Entity.EF6
11) Check the versions of the MySql.Data and MySql.Web libraries. If they are under 6.9.6 delete them as well
12) Add a new reference by browsing to the install location for the mysql connector for your version of the .NET framework (mine is C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5) and grabbing the MySql.Data.Entity.EF6.dll (my version is 6.9.6, keep that in mind when we change the web.config later)
13) If the other libraries were also older versions, add references to them by browsing to the packages folder in your solution and grabbing the files from their respective folders. I do not normally have to do this.
14) Now the Web.config will need to be edited. The first step is to replace the entity framework section with this code (change the version number to your current version. Please note that I found this snippet on the web a couple weeks ago and do not have the original link. I apologize to the original poster of this information.)
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
15) Make sure your DbProviderFactories section matches
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
16) Save and build
I am not sure how many of these steps are actually required but after finally getting it once I had to actually get some work done and didn’t have time to narrow things down further. Hopefully that gets you moving.
P.S. If after all of that you go through the wizard and it just disappears before it shows you the tables in the database to create entities from then it could be one of three problems I have run into along the way. The database server cannot be contacted. The user does not have the needed permissions on the database. The wrong version of MySql.Data.Entity.EF6 was added as a reference or the version number is wrong in the web.config. If I grab this file from the packages directory of my solution I often run into this aborted-wizard-with-no-error-message problem. Grabbing it from the MySql install directory has worked fine for me every time.
It works for me.
I have Visual Studio 2015, and just installed latest version of connector:
http://dev.mysql.com/downloads/windows/visualstudio/
Read this more carefully:
http://dev.mysql.com/doc/relnotes/mysql-for-visual-studio/en/visual-studio-news-1-2-4.html
They mention that version of "Microsoft ASP.NET MVC" could be a problem.
Wrong is that they say VS2015 ships with version 5, but I have version 4 installed with VS2015 Enterprise final.
Tried this and it didn't work for me. What eventually worked was making sure I had the right driver. I run a 64bit Windows 7 computer. I eventually had to install the 32bit version of the MySQL ODBC connector/driver and used the following connection string "Provider=MSDASQL; Driver={MySQL ODBC 5.3 ANSI Driver}; Server=localhost; Database=xxxx; User=xxxx; password=xxxx; Option=3;" and that solved it. tested it on a new project without making all the above changes, and it worked just fine. This post was super helpful in explaining this: https://support.microsoft.com/en-us/kb/942976. Hope this saves someone a lot of time
install the package from this site. http://dev.mysql.com/downloads/windows/visualstudio/ in the Development release tab.
I stopped Visual Studio.. I installed. WAITED.. Seams to take for ever. Visual studio will be running in the background.
Wait till completed.
reopen Visual Studio. boom back in play!
Good luck !
For VS2015 I removed all version installed and through the MySql Installer - Community. I selected Customize Installation and selected MySQL Connectors to install: 1. MySql for Visual Studio 2) MySQl ConnectorNet.
I added references: MySql.Data y MySql.Data.Entity.EF5 both in
C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5\
Recompiled the project And When creating de ADO.Net Object the famous MySql data provider was shown!
A warning was displayed about Entity Frame Versions, I just clicked Next And worked![enter image description here][1]

The connectionstring property is not initialized

So, I realize that there are a lot of questions on here pertaining to this problem, but none seem to be the same as to what I'm dealing with. I had to delete my dataset out of visual studio and bring it back in. After doing so I got the error. I'm using mysql as a backend, so I'm using the dotconnect for mysql extension for visual studio. Everything was working fine until I did this step. Here is my app.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="RMSteel.My.MySettings.RMSteelConnectionString" connectionString="User Id=rmsteel;Password=password;Host=192.168.0.46;Database=RMSteel;Persist Security Info=True"
providerName="Devart.Data.MySql" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
Whenever I use my connection I use the name RMSteel.My.MySettings.RMSteelConnectionString, since this is auto-generated (I assume by dotconnect). I am fairly far in this project and would like to find a fix using this connection string, so I don't have to rewrite that much. Thanks for any help, and if you'd like me to post more code, I can.

Cant get my connection to a MySQL from asp.net mvc project to work

I am trying to get MVC 3 Application to use a MySql database, but I keep getting errors, I have made the following connectionstring and provider in my Web.Config file
<connectionStrings>
<add name="DefaultConnection" connectionString="server=xxxxx.unoeuro.com; userid=xxxxx_dk;password=xxxxx;pooling=yes;Database=xxxxx_dk_db" providerName="MySql_db"/>
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="MySql_db" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=5.1.54.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
But when I try to use it (Just trying to use the default register user that is in a default project) I get this error
An error occurred creating the configuration section handler for
system.data: Column 'InvariantName' is constrained to be unique.
Value 'MySql.Data.MySqlClient' is already present.
But I if I remove the DbProviderFactories I just get an error that there is missing a data provider, so its not becuase I duplicated it anywhere
Building upon #Ladislav Mrnka's answer, the error is probably occurring because the setting in Web.config is conflicting with one in machine.config. To eliminate the error, add a "remove" tag to your Web.config as follows.
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySql_db" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=5.1.54.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
Provider name in connection string must be set to invariant name of provider factory. Also the error most probably says that you already have MySql.Data.MySqlClient installed on your machine and registered in Machine.config.
Install the latest version of MySQL for visual studio and find a compatible version for Connector/NET.
For example, I have used MySQL for Visual Studio 1.2.7. and Connector/NET 6.7.5, 6.8.3 or 6.9.x. for Visual Studio 2013
uninstall all the other versions of MySQL for visual studio and Connector/NET.
After that Add new item-> ADO.Net Entity Data Model and create the edmx file.
you can see system.data and system.data.entity in your reference folder of the project.
In your code
MyDatabaseEntities myDB = new MyDatabaseEntities();
use myDB to access your data.
If you are creating a framework project, copy everything under tag from app.config and paste it into your main project's(startup project) web.config file
One thing needs to keep in mind that this tag should be the first child of tag.

Difference in Forms Authentication between Razor Preview and Razor Beta?

I'm attempting to upgrade an MVC project to Beta using Razor (from the Preview release) and am now experiencing strangeness with Razor not going to my login view that it use to go to (when someone asks for an action that required authorization).
My web config has
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
But whenever an action with the Authorize attribute is hit, the browser redirects to "Account/Login" - notice Log*in* NOT Log*On*. Anyone know how to fix this in MVC 3 Beta?
It is a known bug in Beta: Release Notes: Chapter Known Issues
There’s a known issue that causes Forms Authentication to always redirect unauthenticated users to /Account/Login, ignoring the forms authentication setting used in Web.config. The workaround is to add the following app setting.
<add key="autoFormsAuthentication" value="false" />
Try adding the following the <configuration> section of your application's Web.config file:
<appSettings>
<add key="enableSimpleMembership" value="false" />
</appSettings>
All you need is to disable the authentication mode="Forms".
I removed the authentication section and it started to work.
<!--
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
-->