Error doing web.config transformation for different environments - visual-studio-2012

I was trying to deploy my app into different environments then i started following this how to:
Deploying an ASP.NET Web Application to a Hosting Provider using Visual Studio or Visual Web Developer: Web.Config File Transformations - 3 of 12
was perfect until I clicked in Preview Transform, I received this error:
Microsoft Visual Studio
Could not load file or assembly 'Microsoft.Web.XmlTransform, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
(I created just one transformation Web.DebugQA.config and of course the default ones, debug and release)
my Web.DebugQA.config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
</system.web>
<appSettings>
<add key="EnvironmentName" value="QADev" xdt:Transform="SetAttributes(value)"
xdt:Locator="Match(key)" />
</appSettings>
</configuration>
but then I install this plugin:
SlowCheetah - XML Transforms
and I solved my preview transform error, but then when I was trying to publish using the QADev transform I got this error:
The "ImportParametersFile" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.XmlTransform, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Web.XmlTransform, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.Web.Publishing.Tasks.ImportParametersFile.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
I'm using Visual Studio Pro 2012.

I fixed this by repairing "Microsoft ASP.NET and Web Tools 2013.1 - Visual Studio 2012" from Control Panel --> Programs and Features.
The file Microsoft.Web.XmlTransform.dll was missing from the path C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web.

I had a similar error, although it was caused for different reasons.
I solved it copying the following DLL from another PC with VS2012 installed:
Microsoft.Web.XmlTransforms.dll
from: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web
I hope this helps

I had same problem in VS2012, could not 'Preview Transform' for the PublishPackage tranforms e.g. Web.Staging.config complaining about Microsoft.Web.XmlTransform
I got it working by adding the Package https://nuget.org/packages/Microsoft.Web.Xdt to my Mvc 4.5 project. This package is still in pre release.
PM> Install-Package Microsoft.Web.Xdt -Pre
This package contains the Microsoft.Web.XmlTransform.dll
I still get an error during building complaining about "Could not load file or assembly Microsoft.Web.XmlTransform". The Mvc project has still built ok.
I did try adding the Microsoft.Web.XmlTransform.dll to the Gac using the gacutil but that did not fix the problem.
However I use Team Foundation Service build server and it works and creates the correct Web.config after applying the Web.Release.config and then the Web.Staging.config.

I tried below two things but it did not work for me.
1) copying the Microsoft.Web.XmlTransforms.dll DLL to location C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web
2) And repairing "Microsoft ASP.NET and Web Tools 2013.1 - Visual Studio 2012"
Then I uninstalled Microsoft Azure tool V2.6 from control panel -> Programs and Features. And then I can able to publish my site.

This may have been fixed in Visual Studio 2012 Update 2 (and Visual Studio 2013).
Web.config "Preview Transform" gives an error
...
Posted by Microsoft on 3/1/2013 at 2:46 PM
Thanks for reporting the issue! It will be fixed in Visual Studio 2012 Update 2. Please install it when it becomes available.

Related

Failed to Start Process with Commandline VSIISExeLauncher.exe in IIS 10.0

Thursday night, I was working on a project built in ASP.NET Core 2.1 (being prepared for ASP.NET Core 2.2) running on my local IIS 10.0 (not IIS Express) and was able to run it without any issue. Friday morning, after heading into the office, I was met with the following error every time I try to run my solution in Visual Studio:
Unable to start process C:\Program Files (x86)\dotnet\dotnet.exe. The web server request failed with status code 502, Bad Gateway. The full response has been written to [file_name].html.
When I open the [file_name].html, I'm given the response:
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
When I open the Event Viewer, I'm given the response:
Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE/[Path]' with physical root '[Path]' failed to start process with commandline '[Path]\bin\IISSupport\VSIISExeLauncher.exe -argFile IISExeLauncherArgs.txt', ErrorCode = '0x800700c1' : 0.
I have:
Turned off and on the IIS through Windows Features, making sure the correct Internet Information Services features were checked
Created an Application Pool where [.NET CLR version] is set to "No Managed Code" and [Managed pipeline mode] is set to "Integrated"
Uninstalled and Reinstalled: IIS Url Rewrite to IIS
Uninstalled and Reinstalled: Microsoft .NET Core SDK - 2.1.504 (x64)
Uninstalled and Reinstalled: Microsoft .NET Core SDK - 2.1.504 (x84)
Uninstalled and Reinstalled: Microsoft .NET Core SDK - 2.2.104 (x64)
Uninstalled and Reinstalled: Microsoft .NET Core SDK - 2.2.104 (x84)
Uninstalled and Reinstalled: Microsoft .NET Core Runtime - 2.1.8 (x64)
Uninstalled and Reinstalled: Microsoft .NET Core Runtime - 2.1.8 (x86)
Uninstalled and Reinstalled: Microsoft .NET Core Runtime - 2.2.2 (x64)
Uninstalled and Reinstalled: Microsoft .NET Core Runtime - 2.2.2 (x86)
Uninstalled and Reinstalled: Microsoft .NET Core 2.1.8 - Windows Server Hosting
Uninstalled and Reinstalled: Microsoft .NET Core 2.2.2 - Windows Server Hosting
Restarted my computer after ever re-installation
What else can I try because none of my other projects are working either.
In my case this issue occurred when I manually cleared the bin folder (which deleted the necessary files in the IISSupport folder) and tried to load the application which was set up as an application under my localhost in IIS.
To solve all I needed to do was to run the application through Visual Studio, which added the necessary IISSupport folder and files to the bin.
I got this fixed by re-installing the Visual studio. Still I'm not sure if this is the best way to fix this.
I've also tried all the approaches mentioned in this question but nothing fixed the issue.
I found the solution.
In the root folder of my team's project, there was an empty "file" file titled "The". For the sake of things, our project is called "The Project" with a space between the words. I removed this file and everything built fine.
My guess is that getting the latest files from our Teams server must have generated a half-formed file and messed with the build of my project.
In my case, my project was setup as a website in IIS and the file "bin\IISSupport\VSIISExeLauncher.exe" was missing in the project's directory.
I simply selected "IIS" when debugging the project in Visual Studio 2019 and it generated the missing file. It also generated 2 text files (IISExeLauncherArgs.txt, pidfile.txt) in the IISSupport folder, made changes to my web.config file, and my project ran successfully.
After that I was able to access the local website that was setup in IIS without running it in Visual Studio.
In my case, the issue is in launchSettings.json.
First, make sure which profile you are running while click run button.
my case is 'IIS Express',
Then open the file, go to =>Profiles, make sure the command name in IIS Express profile.
my case is IIS. more details about command name.
And check iisSettings in above section.
my case is using IIS as command, so I check iis => applictionUrl and sslPort.
the issue is here, the application url is using a different domain name.
which is different from the launch URL. once i republish the website on my local dev box using the launch url domain, it works fine. BTW, we use host file to fake those domain names.
if you have other team members working on the same project, make sure you all use same settings of the dev web site. or developers can just edit it locally, do not check in the settings if it could not work on other developer's machine.
in my case i solved the error deleting the .vs folder on the project root and i restarted visual studio.
I had an issue with failed to start process with commandline on the remote IIS. I had to add the web.config to the project and ensure it would be published. The default file looks like below:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section. For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<system.webServer>
<handlers>
<remove name="aspNetCore" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</configuration>
I replaced %LAUNCHER_PATH% with dotnet and %LAUNCHER_ARGS% with .\MyProjectNameHere.dll like
<aspNetCore processPath="dotnet" arguments=".\Web.Api.V3.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">

CS0012 The type 'XtraReport' is defined in an assembly that is not referenced

I recently updated my visual studio to 2017 Enterprise.
I used to use DevExpress v15.1
Today, I upgraded my DevExpress to version 18.1 and when I build my .Net MVC5 Application Solution, I got the following error
The type 'XtraReport' is defined in an assembly that is not
referenced. You must add a reference to assembly
'DevExpress.XtraReports.v15.1, Version=15.1.8.0, Culture=neutral,
PublicKeyToken=b88d1754d700e49a'.
The above Error is located in ReportController.cs
I checked my references Folder under the project to find that the DevExpress.XtraReports.v18.1 is there.
What might be the cause of this error?.
Thank you for your help.
Based from the message, the XtraReport still references the older version of its DLL assembly:
'DevExpress.XtraReports.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a'
Usually this problem occurred because Project Converter failed to update XtraReport related references after upgrade. In this case, you can manually remove all references to older assemblies (version 15.1) and then add references to new assemblies (version 18.1).
Also make sure that web.config file has these assembly information like below example (X indicates revision number):
<add assembly="DevExpress.XtraReports.v18.1, Version=18.1.X.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.XtraReports.v18.1.Web, Version=18.1.X.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
If the solution above failed, try install the assemblies to the Global Assembly Cache (GAC) by navigating to X:\Windows\assembly (X stands for the system drive letter) and copy all new DevExpress assemblies to that folder (including DevExpress.XtraReports.v18.1), as mentioned in this issue.
Related issues:
Errors after upgrading DevExpress version
DevExpress.XtraReports.UI.XtraReport is not defined after upgrade
The type 'DevExpress.XtraReports.UI.XtraReport' is defined in an assembly that is not referenced

MSTest fails to load dll from network share

I am running MSTest (on a Microsoft Azure VM) to test a DLL which is in a network file share (linked to Azure File Storage).
I get this error -
Could not load file or assembly 'file:///P:\test\bin\mydll.dll' or one
of its dependencies. Operation is not supported. (Exception from
HRESULT: 0x80131515)
Solution 1:
xcopy the folder containing the dll and its dependencies from the network share to a local disk and run it from there.
Solution 2:
This solution is preferable because it saves the copy step.
Find the folder that contains MSTest.exe. In my case here:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
Open MSTest.exe.config (it should already exist) and add the following line under<runtime> :
<loadFromRemoteSources enabled="true"/>
in context:
<configuration>
<runtime>
<loadFromRemoteSources enabled="true"/>
...
From: MSDN: <loadFromRemoteSources> element.
Confusingly, it says:
In the .NET Framework 4.5, assemblies on local network shares are run
as full trust by default; you do not have to enable the
<loadFromRemoteSources> element.
I am targeting .NET 4.5, but I got the error until I enabled loadFromRemoteSources.

Building Visual Studio C++ solution 2015 failed using TFS 2013 team build

We have TFS build machine configured to build source code from TFS. On this machine we had Team Foundation Server 2013 together with Microsoft Build Tools 2013 installed and then recently, we installed Microsoft Build Tools 2015. In the build defintion, we put /tv:14.0 for MSBuild arguments to indicate we want to use version 14.0 of MSBuild. Also, we set the perform code analysis to be false so that it won't perform code analysis.
However, when we queue a build, it failed with given errors:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets (214): The source file for this compilation can be found at: "C:\Users\tfsservice\AppData\Local\Temp\b54ca1bb-e696-4214-a196-5c79c32345cd.txt"
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets (214): An error has occurred during compilation. error CS1705: Assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' uses 'Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets (214): The "SetEnvironmentVariable" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild\14.0\bin\amd64" directory.
Does anybody experience this issue before?
It seems like the Microsoft.Build.Utilities.Core was referenced to the incorrect version of Microsoft.Build.Framework.
However, in MSBuild.exe.config, this assembly is redirected corectlly
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="14.0.0.0"/>
</dependentAssembly>
Any helps are appreciated.
P.s. The solution we want to build is a visual c++ solution upgraded from VS 2013 to VS 2015.
Seems that many other community members have the similar issue, the /tv:14.0 argument doesn't work. Check this link for the detailed information.
The workaround is: instead of using the /tv:14.0 argument, you need to customize the tfs build process template to set ToolPath of the Run MSBuild for Project to target to MSBuild14; and set ToolVersion to "14.0".

How to fix Newtonsoft.Json assembly loading error?

I'm attempting to load a pre-existing Umbraco CMS site into a Visual Studio project and am caught up in a bit of DLL hell.
Here is the error message I get when attempting to compile the site:
Could not load types from assembly Umbraco.Core, Version=1.0.5462.37503, Culture=neutral, PublicKeyToken=null, errors:
Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
I've attempted to re-install Newtonsoft from NuGet, re-install Umbraco from NuGet, delete all DLLs and re-install, removed the Newtonsoft dependentAssembly, every possible solution I've been able to find and this error continues to come up.
Any suggestions?
I'm guessing the binding redirect isn't set up correctly in the web.config file. Try running this in the nuget package manager console:
PM> Get-Project –All | Add-BindingRedirect
This ended up being a bit of a misunderstanding on my part from following the Umbraco videos. I was attempting to set up a new Visual Studio project, import all the DLLs needed, and then move the site content into the project.
All I really needed to do was create a blank project, then move the site content, with all of its DLLs, into the project. This let me immediately start editing the project.
The best solution was to install an earlier version of the package and then upgrade.

Resources