Visual Studio ClickOnce Publish fails - c#

I have created a C# 4.0 WinForms application using Visual Studio 2010 Premium SP1 on Windows 10.
Over the months I have modified and deployed this same App many times, using ClickOnce.
I have never had any difficulty until today.
I made one small modification to the code, which works successfully.
However, after building, and attempting to publish, 2-separate errors are thrown, as listed below.
#1) Cannot publish because a project failed to build.
#2) An error occurred while signing: The parameter is incorrect.
My application does contain a separate project, which is only a Splash Screen project.
If I go to Solution Explorer and attempt to build the 2nd project, it builds fine.
I have also tried to Build > Publish by using the menu in Solution Explorer, rather than from the Publish pane of VS.
Not only is it puzzling why a publish is failing suddenly now, but the error messages do not provide any clue as to where in the code a problem is arising, if indeed it's in the code.
Can anyone suggest how to correct this situation, as I am unable to publish my app any longer.

This error was puzzling, as I've used ClickOnce to deploy modified versions of my App many times. On a hunch, I decided to change the TimeStamp server from the following:
http://timestamp.globalsign.com/scripts/timstamp.dll
to this:
http://timestamp.globalsign.com/?signature=sha2
Since researching this error referenced the fact that Microsoft would no longer recognize SHA1, but needed the SHA2 cryptography, I tried using this latter server and after compiling, it allowed my app to do a successful publish.
If anyone else runs into this problem, the above solution may prove useful.

Related

MSBuild publish not working for Office VSTO

I have been going crazy trying to fix this publishing issue for days. I have a VSTO application for Office that builds using MSbuild.exe successfully, in both debug and release. The problem arises when I try to run MSbuild like such: MSBuild -t:publish. The funny thing is, when I use the publishing wizard in Visual Studio 2019 Community, my application publishes properly. I only have issues when trying to use MSBuild.exe with the publish target, not with normal builds.
By right-clicking my project in VS 2019 and clicking Publish, I see this wizard which produces the expected result.
Expected Result:
MSbuild produces a publish directory with a .vsto file for my application along with a a reference directory with dependencies and/or a setup.exe
The expected result of running MSbuild with the publish target.
Actual Result:
When running MSBuild -t:publish in a command line that is CD'ed to the directory of my project, I get this error:
Project "D:\repositories\myapp\myapp.sln" (1) is building "D:\repositories\myapp\myapp
.csproj" (2) on node 1 (Publish target(s)).
_DeploymentUnpublishable:
Skipping unpublishable project.
Things I tried:
I tried a lot of things to get this to work. I read these threads:
First thread : Applies to ASP.net applications not VSTO, also says that McAfee can cause issues. I disabled all antivirus on my machine, still no luck. I have tried adding properties such as: /p:DeployOnBuild=true /p:OutputPath="publish/" /p:PublishDir="publish" /p:VisualStudioVersion=16.11 (my version) and all combinations of these and it never worked. I tried using /t:Package but I get the error: error MSB4057: The target "Package" does not exist in the project.
Adding <OutputType>winexe</OutputType> to my .csproj does not work because this application produces a DLL on normal builds, not an executable.
Second thread
I already have this installed. I'm testing the command line publish on my local development machine before I try this on the build server.
Third thread I am not using a shared add-in.
Fourth Thread ITT and others, they recommend using a .pubxml but I cannot figure out how to make one of those, AFAIK they are generated by ASP.net applications and not applicable to a VSTO application. I could be wrong, but again I don't know how to create one properly.
Fifth Resource This is a lot of stuff to do, and I am confused if it will even work. I DO have VS 2019 installed, my program builds successfully and runs successfully, and even publishes successfully when using the publishing wizard. I am not using TFS. I am just trying to produce the VSTO via command line.
For anyone who runs into this problem, it is because you are not loading:
Microsoft.VisualStudio.Tools.Office.targets
I wish the log would have been more specific about that.

Visual Studio 15.9.3 breaks web forms?

I have a 15 year old web forms app targeting .NET 4.6.1 that I'm maintaining, and I recently upgraded my laptop to VS 15.9.3. A release build of this app with 15.9.3 no longer fires the Application_Start event on production servers (running .NET 4.7.2). It runs locally just fine and I frequently deployed production builds from this laptop prior to the upgrade.
My desktop computer is still running VS 15.8, and a production build there works fine. The source code is the same between these machines, only the VS versions differ.
Symptoms and attempts at remedies:
I cleaned out all old files from production and tried setting it up from scratch. No dice.
Setup new application under IIS using the same build, but the outcome is the same.
Nothing in the event logs about any errors, except for the error that gets raised when some pages try to access state that's initialized in Application_Start.
I try to log some messages and even raise an exception right at the start of Application_Start, and I don't see anything, so Application_Start is definitely not running.
What can I do to further diagnose the problem? I haven't been able to find anything about this online, or why the newest VS release suddenly doesn't work.
Barring any remedies, any suggestions for downgrading VS instead of completely uninstalling and reinstalling the older VS?
Edit: now even reverting my laptop to VS 15.8.9 did not roll back the problem, so I've disassembled a build from both machines. There are few differences, basically the build number of a dependent assembly, the module version identifier, the comment designating the "image base":
Not working build:
// Image base: 0x055E0000
Working build:
// Image base: 0x052D0000
As far as I understand, none of these differences should have any observable effect. I then disassembled the dependent assembly that's built alongside the ASP.NET app, and it has the above differences and a few more related to the offsets for static field initializers. So I still have no idea why this might be happening.
Edit 2: it seems the issue is in the final aspnet_merge step while trying to merge the precompiled web forms. The merge fails in finding any assemblies to merge, suggesting that precompilation may have failed.

Cannot debug local C# code used in U-SQL since VS2017 15.7.1 upgrade; Local run failed or was terminated

(I also posted this a couple days ago on the MSDN Data Lake forum, so I thought I'd expand the audience here)
I have a custom extractor, as well as a custom assembly that have been working for the past several weeks+ - I have been able to debug locally stepping into the code up until Friday morning. I am still able to Submit the U_SQL script locally and it successfully runs producing a local output file, but when I F5 to debug I "Local run failed or was terminated" and the output file is not created.
Is there a detailed log somewhere to see what exception is being thrown? Nothing in the event viewer.
I have completely reinstalled VS2017 back to 15.0, then tried updated to just 15.6.x but get the latest 15.7.1 again. Same issue with multiple projects now.
Has anyone encountered this?
error message display
The root cause has been identified. It is because of a bug in Windows 10 1803 update that causes failure when creating a local mailslot for IPC. This IPC is used during local debug session. The Windows team is working on a fix now.
The alternative fix in the development tools was release yesterday as version 2.3.4000.3 of ADL Tools. You will need to upgrade it in VisualStudio 2017 -> Tools -> Extension and Updates -> Updates -> Visual Studio Marketplace.
For VS 2015 users, please get the update from: https://www.microsoft.com/en-us/download/details.aspx?id=49504
For users who want to know more details, the correspondent Windows OS fix is done but not yet available. The alternative fix in development tools is to use \\.\mailslot instead of \\localhostname\mailslot

Could not find file 'obj\x86\Debug\projectname.exe'

I have developed a windows application using C# VS 2010. It was working perfectly fine untill I added another project for making a setup.exe to be distributed. But now when I try to run my project it gives error "Could not find file 'obj\x86\Debug\projectname.exe'." and asks if I would like to continue and run the last successful build? If I choose yes it runs a previouse version of application and don't show latest functions and interface changes which I made. Now setup project has been removed and there is single project in solution but still getting same error. I checked debug folder and there is no file named as projectname.exe.
NOTE : Projectname is name of my project
Well Avast antivirus was a problem. I don't know how but I turned off avast and build my application and it worked just fine. ... not a big proble .. sighhhhhhhh

Setup and Deployment does not work

I am working on VS 2008 and 3.5 framework.
I had three windows services.
I placed all three in a single solution, created installer individually for each of them.
Then created a setup project.
When I build it says build failed .
But I checked on the errorlist, (i enabled the diagnostics in options menu), but there was no error at all.
I went ahead and installed. There were no issues, But there was no service showed up in the services.msc.
I installed each service individually , using installutil command, it showed up.
But my requirement is to bundle these services and deploy to the client.
The client should install it.
Where am I going wrong.
Any inputs will be highly appreciated.
Regards
cmrhema
I notice your comment above about omitting the custom action. Same mistake I made! For posterity, here's the entire process:
Make sure you have added the project installer to your service project (described here). These components give your service EXE the ability to register itself with the service manager.
Add a setup project to your solution.
Add the primary output from your service project to the setup project (described here). This puts the binary into the application directory.
Add a custom deployment action to your setup project containing the primary output from your service project. This looks like a repeat of step 3, but what it's actually doing here is registering your service with the service manager.
This walkthrough goes through each of these steps in some detail.
I too have a similar problem with VS 2008 and I believe it is a bug in the IDE rather than anything you're doing wrong.
Basically what happens is that VS reports a failed build, but does not indicate any reason for the failure. I find that restarting Visual Studio and then performing another build allows the build to succeed.
I read somewhere that for some people the bug is caused by some auto-created project file, but a restart fixes the problem for me.
Build failed -> what else is there in the Output window?
For some general reference regarding setup projects for windows services in .net:
http://msdn.microsoft.com/en-us/library/aa983650%28VS.71%29.aspx
http://support.microsoft.com/kb/317421

Categories

Resources