VS 2015 Publishing Issues - c#-4.0

I can build and debug my project (Web Forms App / VS 2015) but when I attempt to publish I don't get any errors (in the standard errors panel) but in the output window I see I do and the publish fails, but the build runs !?!?!?!?
Each of the types do exist and the namespacing is correct, I have no idea why these issues are stopping me from publishing ?!?!?!?!

The issue fixed itself, I didn't do anything or make any significant changes.

Related

Remote Debugging Blazor WASM on Azure?

I've tried using the standard Blazor template app to remote debug on an Azure app service and I get the following error:(the app run fine if a compile to release, though not debugging of course.)
I compile to debug any CPU.
UPDATE
I can debugger in my .razor pages.
PRIVIOUS
Judging from your error message, the problem may be caused by unsuccessful release of some files and other factors when the program was released.
In order to solve your problem, you can tell us the version of Visual Studio you are using and how you created the project. This problem is mostly related to your development tool environment configuration.
Here is a suggestion, test it by yourself and it runs normally.
Visual Studio 2019 Enterprise Edition (other versions should also be normal)
Configuration before project release
Start remote debugging
The final result

visual studio 2017 remote debugging azure api app: "The breakpoint will not currently be hit. No symbols have been loaded for this document."

I'm trying to remote debug an asp.net core 1.1 api app (targeting .net framework 4.5.2) that's running on Azure.
I attach the debugger via Server Explorer. The debugger attaches to the correct process. But any breakpoint I set has the message "The breakpoint will not currently be hit. No symbols have been loaded for this document."
All answers I've seen to such a problem assume that the modules window shows all modules loaded by my project, but in my case the modules window is empty!
I'm on VS2017 15.4.
If I remember correctly, I was previously able to remote debug the same project with version 15.2. The problem started occurring when I updated to 15.3 but I didn't pursue it at the time.
I submitted the problem on the MS forums: Can't remote debug Azure API app
and now I have received an official reply that it is indeed a bug in VS, and a fix will be available in the pending release (15.6).
They also suggested a workaround, which I tried and indeed worked: Manually Attach a Debugger to Azure Web Apps
Which involves:
Going to the web app Application settings in the Azure portal, and making sure that Remote debugging is enabled,
In the VS menu: Debug > Attach to Process..., entering the web app url with the debugging port, e.g.:
myapp.azurewebsites.net:4022
Then in the credentials that appears, entering the username & password that are available in the app's Publish Profile, which can be downloaded from the portal. If the username is $myapp, it should be entered like this:
$myappp\$myapp
Then choosing Managed(v4.6, v4.5, v4.0) code and then the name of the Core app.
Actually, I had found and unsuccessfully tried similar approaches before. The key for me was step 3. The others had suggested entering the username as .\$myapp, or myapp\$myapp. So make sure to enter it as written above.
BTW, seeing that the above blog post is from almost 2 years ago (Feb 2016), whereas the problem I'm experiencing was introduced only a few months ago, it seems to be a cure-all, and it is therefore worthwhile, for anyone who has to deal with remote debugging Azure apps, to save this information for future reference.
UPDATE:
After updating VS 2017 to version 15.5.2 the problem seems to have been fixed.
I have had the same issue with Visual Studio 2019. The fix for me was just to go in the VS menu: Debug > Attach to Process, and try to connect as describe by #Dan Z. The connection was not established, saying No connections found, but attaching a debugger from Cloud Explorer again, right after an attempt in "Debug > Attach to Process" is always successful. That is most probably a bug in VS

Prevent Code Analysis from testing Provider Hosted Apps

I am on a SharePoint project that has a dozen or so Provider Hosted Applications.
For those not familiar, PHA's are basically fancy MVC web apps but they have a secondary "special" project that gets added to the solution that contains an app manifest used by SharePoint (sort of reminiscent of old VDPROJ project types). This special project type is only used when packaging the application for consumption by SharePoint, it serves no other purpose and therefore has no need for generating output such as DLL's or EXE's (except for when creating a deployment package, but that is irrelevant to this conversation).
The problem I am having is Visual Studio fails when running Code Analysis on all the PHA's because the PHA's app project does not generate a DLL. The analysis isn't running and reporting errors, it has a hard failure because it is expecting the special app project to generate a DLL and that DLL is physically not found. This prevents Code Analysis from even getting to the point of checking if the checkbox for "Enable Code Analysis on Build" is checked or not (which it isn't in case you're wondering). The only thing I get is two error messages like this person on CodePlex was having:
CA0052 Error Running Code Analysis CA0052: No targets were selected. [Errors and Warnings] (Global)
CA0055 Error Running Code Analysis CA0055 : * Could not load file: 'bin\Debug\xxxxx.dll'. [Errors and Warnings] (Global)
I have even gone to the point of creating a brand new PHA project from scratch using the Visual Studio 2013 wizard leaving everything as default which should eliminate any potential for hard external references the existing projects might have. Even then I still run into the same problem. Every time Code Analysis is run Studio tries to test that special project and throws the hard failure.
The weird thing is Code Analysis is running on the TFS build agent without incident. This leads me to think that the issue is Studio related and specific to the version installed locally. However, I have tried this with VS2013 RTM, 2013 Update 5, and VS2015 Update 3 and they ALL behave the same. Create a new PHA, follow the prompts for local development using MVC, and then run Alt-F11 and the issue reproduces.
Can anyone get Code Analysis to work on a SharePoint PHA?

Visual Studio 2017 publish to Azure fails with null reference ("object reference not set to an instance of an object")

Crash on Azure publish from Visual Studio. The same thing happens in previous versions of Visual Studio, but in the past I've been able to work around the bug by clearing the appdata and if necessary resorting to resetting user settings per the responses to this question about a VS2015 issue.
Azure publish has been working up to now in 2017. Suddenly I am getting the dreaded null reference, and this time clearing the aforementioned data has not helped:
Restarted Visual Studio, restarted machine, cleared data a second time including both roaming and local appdata, all to no avail.
Just for others searching, in my case the issue was that I had previously disabled the "Microsoft VisualStudio Managed Publish" extension in VS2017 (probably in an attempt to get VS to be more responsive). To re-enable it, go to Tools > Extensions and Updates, enable it, then restart VS:
Thank you for your sharing. I have the same case as you. I accidently disabled the "Microsoft VisualStudio Managed Publish" extension in VS2017. The publish menu even doesn't show up in .net core solution explorer. To re-enable it, go to Tools > Extensions and Updates, enable it, then restart VS.
Unchecking/unselecting the Application Insights in the Publish workflow of Visual Studio 2017 fix the error for me.
This can be caused by a validation error in the service definition and configuration files.
Even though the editor doesn't highlight any problems, and the build completes successfully, there can be errors in these files and they are not handled properly when you attempt to publish, giving the null reference error.
I encountered this after modifying the files per these steps to configure SSL. I really wasn't expecting that to be the culprit, but in desperation I was trying everything I could think of that might be causing the problem. As soon as I commented out the change to the <certificates> element, the null reference error went away, and the publish succeeded.
(I now need to work out why the steps for SSL configuration didn't work, perhaps due to a change introduced by VS2017, but that's another story.)
I was experiencing the same issue as the OP. I created a new DB Project and then compared the settings of the new DB Project with the DB Project that was causing the Null Reference Exception upon Build or Publish. I noticed that our output directory was redirected to a non-standard location. After deleting all the files in the bin folder, the Build and Publish started working. YMMV
I found a lot of answers around that -- so may be there are more than one -- but none worked for me.
On my system it worked again after removing the installations for ASP.NET and Azure and installing it newly .. --> evth is fine.

Root element is missing when trying to Publish

It has been a while since I've published my app to Azure. During that time frame, I've upgraded my system from 32-bit to 64-bit meaning a fresh install of Windows and Visual Studio. And Visual Studio Update 3 came out and was applied. When I went to publish an update today, I received the following:
The following exception was thrown trying to publish: Root element is missing.
My web.config file looks fine so I don't think it's this issue.
The app works fine in debug mode so I don't think it's any of the .lsml files as is mentioned here.
And I tried this procedure to hand edit the .ls3proj file but it didn't seem to help.
I previously had an issue trying to publish when I upgraded from the standalone LightSwitch 2011 to Visual Studio 2012. I was able to overcome that issue using the method described in this thread.
Attempting to use this same method resulted in my new project has a full screen error saying "There are critical errors in the application definition metadata..." and 210 individual errors (max errors reached).
The first error, "Cannot create unknown type '{http://schemas.microsoft.com/LightSwitch/2010/xaml/model}GlobalAttributeGroup'." Doesn't make sense because that line in the .lsml is identical from the old project to the new project.
The second error, "Could not find any application definition in the project." Which I do not understand at all.
I am able to publish a simple "Hello, world" style app to my Azure account.
What could be causing this? How can I get more information about exactly which element is causing the issue? The log produced by running devenv /log was not helpful.
Matt Thalman was able to solve my problem over in the Microsoft Forums. The ServiceConfiguration.cscfg and ServiceDefinition.csdef were missing from the project when checked out of version control. Copying those over from a new project restored my ability to publish.

Resources