Visual Studio 2017 crashes on startup - crash

after VS works for a while, it suddenly (sometimes after extension update, sometimes without a visible reason) crashes on startup with a messagebox "Unknown Error". I tried /safemode from DEV commandline - same result.
I created al log file with /log xxx from DEV commandline. See the excerpt below, please.
The problem occured multiple times on my and my colleagues work station. We can delete the app settings and VS starts - of course we have to configure it again. After a while - the same. We work with non admin accounts. When we switch to another account, VS starts properly. Can anybody help, please? We run into this issue since weeks.
....
<entry>
<record>29</record>
<time>2017/05/18 15:03:58.407</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Importing pkgdef file</description>
<path>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\master.pkgdef</path>
</entry>
<entry>
<record>30</record>
<time>2017/05/18 15:03:58.407</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Importing pkgdef file</description>
<path>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\ClassDesigner_REG_27921.3643236F_FC70_11D3_A536_0090278A1BB8.pkgdef</path>
</entry>
<entry>
<record>31</record>
<time>2017/05/18 15:03:58.407</time>
<type>Error</type>
<source>VisualStudio</source>
<description>Failed to process PkgDef file</description>
<hr>80070005 - E_ACCESSDENIED</hr>
<path>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\ClassDesigner_REG_27921.3643236F_FC70_11D3_A536_0090278A1BB8.pkgdef</path>
</entry>
<entry>
<record>32</record>
<time>2017/05/18 15:03:58.407</time>
<type>Error</type>
<source>VisualStudio</source>
<description>PkgDef loading aborted</description>
<hr>80070005 - E_ACCESSDENIED</hr>
</entry>
....
TIA, Matthias

I had similar issue, the solution proposed in Visual Studio 2017 crashes on startup didn't work for me as I didn't find any lock file.The only thing that work for me is to delete privateregistry.user.bin in C:\Users\username\AppData\Local\Microsoft\VisualStudio\15.0_cb69e3d5
You will need at startup to reset settings but at least, VS start.

Meanwhile its classified as a bug:
VS 2017 crashes

Related

Can not publish since moving to VS 2019

I have recently uninstalled VS 2017 and installed VS 2019.
When I publish my website via Web Deploy, if fails with 2 error messages
Failed to load publish certificate dialog due to error of Object reference not set to an instance of an object. MyWebsite.Ui
Web deployment task failed. (Connected to the remote computer ("example.com") using the specified process ("Web Management Service"), but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.)
I'm totally clueless on how I can solve this...
Edit
As per the comments, there is a question which is the same, but that question is about Azure. I'm not connecting to anything Azure related. I'm not saying that this makes my questions unique, more that I don't have the knowledge to understand if the cause/solution is the same. Deploying to Azure from Visual Studio fails when connecting
If you trust the server, then you can simply ignore the warning/error by editing the publish file directly
https://stackoverflow.com/a/33662970/3252861
Open the publish profile file (.pubxml) inside /Properties/PublishProfiles in a text editor
Inside the PropertyGroup element, set AllowUntrustedCertificate to True (AllowUntrustedCertificate> True /AllowUntrustedCertificate>) or add it if it doesn't exist
Set UsePowerShell to False (False).
I didn't do the 3rd point, so I guess I either have previously or didn't need it
Now we can follow the advice on https://developercommunity.visualstudio.com/content/problem/484286/publish-fails-to-iis-using-msdeploy-webdeploy.html and actually add the following 2 entries
<UseMSDeployExe>True</UseMSDeployExe>
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
It should be pointed out that some have reported you only need to use one of those two:
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
So, the start of the pubxml XML file now looks like
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseMSDeployExe>True</UseMSDeployExe>
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<MSDeployServiceURL>domain</MSDeployServiceURL>
<DeployIisAppPath>name</DeployIisAppPath>
<RemoteSitePhysicalPath />
…
…
In your /Properties/PublishProfiles/xxxxxx.Settings.pubxml file, add the following two lines
<UseMSDeployExe>True</UseMSDeployExe>
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
I know this is old, but I did find a different solution that worked for me (after trying to create/upload certificates; reset publishing profiles, etc.)
If you have the nuget package MSBuild.Microsoft.VisualStudio.Web.targets installed in your project, it's old and that's what breaks it. Remove that package and your publish will work. No need to add the AllowUntrusted flat in your pubxml as long as your server IS trusted. (*ie Azure.)
I´m using VS 2019
Add the next lines into PropertyGroup node:
<UseMSDeployExe>True</UseMSDeployExe>
<AllowUntrustedCertificate>true</AllowUntrustedCertificate>
I am from the product team and I can confirm that this is the only property that needs to be set if the server certificate is untrusted.
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
Verify your code if there is any errors /C#/ Razor syntax, sometimes errors will not show in errors window.
Same problem here. I attempted to delete the obj file folder figuring that was the problem. And it was, I had two pdf files in them that wouldn't delete being they required Admin privilege's to delete. I used the command prompt utility to go in and delete them and then did a rebuild and published with no issues.

Visual Studio 2015 exception SqlScriptPreprocessSqlVariables when running web publish wizard with update database

Update:
I have reproduced the same Error with a new empty VS2015 WebApplication project.
Added a connectionString to a new empty SQL database
Added a sql-script file to the solution and selected publish... in the publish wizard.
Example of web Publish wizard with included Update script.
I will get the same error building a web deployment package or web deploy .
Original post:
The "SqlScriptPreprocessSqlVariables" task failed unexpectedly. This happens when I use publishing wizard or MSBuild with a profile where the Update Database is selected. On a newly installed machine with only VS2015 Update1 and also on our build server with Team Fondation Server 2015 Build Agent. The same publish profile works in our VS2013 environment.
System.TypeLoadException: Signature of the body and declaration in a method implementation do not match.
Type: 'Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlCommandExecuter'.
Assembly: 'Microsoft.Web.Publishing.Tasks, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlScriptPreprocessSqlVariables.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask>d__26.MoveNext()
Here is the same error but from the Build Agent in the new build system. I got the same error runnig XAML build on the new Agent.
##[error]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Deploy\Microsoft.Web.Publishing.MSDeploy.Common.targets(119,5): Error MSB4018: The "SqlScriptPreprocessSqlVariables" task failed unexpectedly.
##[error]System.TypeLoadException: Signature of the body and declaration in a method implementation do not match. Type: 'Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlCommandExecuter'. Assembly: 'Microsoft.Web.Publishing.Tasks, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
##[error] at Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlScriptPreprocessSqlVariables.Execute()
##[error] at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
##[error] at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
This is how I fixed the webdeploy packaging problem. This is not a solution I recommend but it works on my machine and on the build server.
Locate the file Microsoft.Web.Publishing.MsDeploy.Common.targets
This is the location on my machine:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Deploy\ Microsoft.Web.Publishing.MsDeploy.Common.targets
On row 117 and forward I commented out the following section.
<!--<SqlScriptPreprocessSqlVariables
UnsupportedKeywords="$(MsdeploySqlUnsupportedCommand)" CheckForUnsupportCommands="$(CheckSqlScriptForUnsupportedCommands)"
TreadSqlScriptUnsupportedCommandsAsWarning="$(TreadSqlScriptUnsupportedCommandsAsWarning)"
SqlScriptFile="%(_DatabasesToPackageForSQL.SourcePath)"
DestinationGroup="%(_DatabasesToPackageForSQL.DestinationGroup)"
ResolveIncludes="$(SqlScriptPreProcessResolveIncludes)"
BatchDelimiter="$(SqlScriptPreProcessBatchDelimiter)"
Condition="$(EnableSqlScriptVariableParameterize) And '%_DatabasesToPackageForSQL.SourcePath)' != '' And Exists('%(_DatabasesToPackageForSQL.SourcePath)') ">
<Output TaskParameter="List" ItemName="_DatabasesToPackage_SqlVariables" />
</SqlScriptPreprocessSqlVariables>-->
I recently faced the same issue and I solved it installing the latest version of "SQL Server Data Tools" and restarting the machine. As #JimAho mentioned, the problem is related to SQL Server Data Tools version installed.
Here you could download it
Don't forget to restart the machine.
Still not quite satisfied with these solutions, I did some research and the least invasive approach I can see is simply registering the assembly in the GAC.
Run VS Command Prompt as Administrator
Hit Windows Start
type "Developer"
Right Click "Developer Command Prompt for VS 2017"
Select Run as Administrator
Run the following command (Replace Enterpise with your installation, e.g. Professional, BuildTools, Community):
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLCommon\130\Microsoft.SqlServer.BatchParser.dll"

Error when building and debugging project in Visual Studio: Loading this assembly would produce a different grant set from other instances

I am working on my project in Visual Studio 2013, and vb.net. Everything is fine until today. My computer auto updated itself yesterday and I got this error when I try to debug my project today.
Error 1 The "ResolveComReference" task could not be instantiated from "Microsoft.
Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Loading this assembly would produce a different grant set from other instances. (Exception
from HRESULT: 0x80131401) Proj1
Does anyone know what is causing this error and how can I fix it?
I was facing the same issue. Following are the steps which sorted my issue:
In Website web config file Changed identity impersonate="true" to
identity impersonate="False"
rebuild it & again changed it to identity impersonate="False"
to identity impersonate="True"
Closed the application.
Delete temporary Internet files(V4.0.0.0 as I was using VS 2010).
Restarted IIS.
Opened Application & rebuild it.
Build Succeeded.
Hope it helps.
Check the project references if all exists for the correct version

How can I fix these errors from Visual Studio Express 2012 for Windows Phone?

I am in Visual Studio Express 2012 for Windows Phone, and have followed the MiniBrowser Tutorial located at the following link:
http://msdn.microsoft.com/en-US/library/windowsphone/develop/ff402526(v=vs.105).aspx
After following all the instructions, once I get to "Run Your App" portion of the instructions, under step 1, Build, the following errors are generated:
Error 1 The name "LocalizedStrings" does not exist in the namespace "clr-namespace:MiniBrowser". c:\users\avery_000\documents\visual studio 2012\Projects\MiniBrowser\MiniBrowser\App.xaml 1 1 MiniBrowser
Error 2 The name "LocalizedStrings" does not exist in the namespace "clr-namespace:MiniBrowser". c:\users\avery_000\documents\visual studio 2012\Projects\MiniBrowser\MiniBrowser\App.xaml 10 9 MiniBrowser
Error 3 The build stopped unexpectedly because of an internal failure.
Microsoft.Build.Exceptions.BuildAbortedException: Build was canceled. Failed to successfully launch or connect to a child MSBuild.exe process. Verify that the MSBuild.exe "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" launches successfully, and that it is loading the same microsoft.build.dll that the launching process loaded. If the location seems incorrect, try specifying the correct location in the BuildParameters object, or with the MSBUILD_EXE_PATH environment variable.
at Microsoft.Build.BackEnd.NodeProviderOutOfProc.CreateNode(Int32 nodeId, INodePacketFactory factory, NodeConfiguration configuration)
at Microsoft.Build.BackEnd.NodeManager.AttemptCreateNode(INodeProvider nodeProvider, NodeConfiguration nodeConfiguration)
at Microsoft.Build.BackEnd.NodeManager.CreateNode(NodeConfiguration configuration, NodeAffinity nodeAffinity)
at Microsoft.Build.Execution.BuildManager.PerformSchedulingActions(IEnumerable`1 responses)
at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker)
at Microsoft.Build.Execution.BuildManager.IssueRequestToScheduler(BuildSubmission submission, Boolean allowMainThreadBuild, BuildRequestBlocker blocker) c:\users\avery_000\documents\visual studio 2012\Projects\MiniBrowser\MiniBrowser\MiniBrowser.csproj MiniBrowser
What do these errors mean?
Looks like when Visual Studio Express 2012 for Windows Phone installed on my computer, it put the project folder onto the same hard drive as the application. For some reason, the solution in order to get this to compile, was to recreate the project on a different hard drive, and work from there.
Thanks everyone for your assistance!

Change default resolution list in Visual Studio Simulator for Windows 8 Apps

Is it possible to change the default screen resolution list in the Visual Studio Simulator for Windows 8 apps?
The simulator looks for additional resolution configurations using the following pattern
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Simulator\12.0\HardwareConfigurations\HardwareConfigurations*.xml
So if you copy the following XML into a file called HardwareConfigurations-SurfacePro3.xml in that folder (you need administrator rights) you get an extra entry in the list allowing you to simulate running on a Surface Pro 3.
<?xml version="1.0" encoding="UTF-8"?>
<ArrayOfHardwareConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<HardwareConfiguration>
<Name>12-2160x1440</Name>
<DisplayName>12" 2160 x 1440 (3:2, 140%)</DisplayName>
<Resolution>
<Height>1440</Height>
<Width>2160</Width>
</Resolution>
<DeviceSize>12</DeviceSize>
<DeviceScaleFactor>140</DeviceScaleFactor>
</HardwareConfiguration>
</ArrayOfHardwareConfiguration>
According to what I found, it is not possible for now.
From this post, it says "The availability of resolutions in the Palette depends upon the supported resolutions of your video card."