I am trying to publish a web application on Visual Studio 2017. The build succeeds but the publishing fails. When it fails an error dialog comes up which says "Publish has encountered an error. Build Failed. A diagnostic log has been written to the following location: .."
This is what the file with the log contains:
System.AggregateException: One or more errors occurred. ---> System.Exception: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass41_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task``1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__116.MoveNext()
---> (Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.
I've tried running the application as Admin but it still doesn't work. I also searched for the Microsoft.Net.Compilers reference but it's not in my project.
Make sure Build + Intellisense is selected, not just Build Only.
That way you can see other errors that might be hiding out there.
Try open visual studio as admin.
Please provide the read write permission for iuser. The folder in which you are publishing by right click on folder > Properties > Security tab
This is because of admin rights , Open the solution in administration mode in the visual studio and publish the solution it will work and make sure that published folder has read write access .
If you have opened vs with admin rights and if you publishing folder has all the read/ write permission you probably need to remove the missing reference from .csproj file
unload your project
right click edit .csproj
remove all the included files that are no longer referenced/used by your current project
re-load your project
try to publish again...
This is user11952046's answer (which I saw after making numerous trials with VS) with more details.
I have stumbled across the same error after realizing that my publish profile was using .NET Core 3.0 as target framework instead of 3.1 (all assemblies were targeting 3.1). Not sure that it is related, but I have also moved the db context + migrations from the main assembly (that contains Startup.cs).
My development environment is VS2019.
Double-checked that publish works on Local IIS. That required elevating the VS 2019 (admin).
While being elevated I have published on target Web server (IIS) and it worked as expected.
Closed and restarted without elevation and published again and it worked.
I am not sure what happened, but I guess that publish had a one-time requirement to change some file that needed elevation.
tl;dr - make at least one publish using VS2019 started as Admin and then you can publishes using non-admin mode.
I have upgraded project framework form 4.0 to 4.7.2 had same issue when trying to publish service, resolved by adding following tags in .cproj file of project
Unload Project >> Edit Project file
Update ToolsVersion="15.0" in following line
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
then add following line after above line
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
add above before following line
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
add following line after above
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false"/>
this solution worked for me able to publish wcf project after upgrading framework from 4.0 to 4.7.2
I faced the same "Build Failed" problem.
All I did to fix it was to enable AppDbContext under Entity Framework Migrations and provide connection string
Disabling Resharper fixed the issue for me!!!
Here is how to disable it
How can I disable ReSharper in Visual Studio and enable it again?
Also some blogs claim updating MSBILD tools will fix the issue.
For me just disabling Resharper worked.
Download the latest version of MSBUILD tools from https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017, run it, choose Modify and then select “Web development build tools” and “.NET Core build tools”.
I faced a similar problem in which I could run my project in debug mode but I whenever I wanted to publish I faced the Build failed problem.
I think this will help someone facing the same issue
If your project path is long try to move the project to a shorter path.
Here is an example, change project path from C:\Users\xxxx\xxxx\xxxx\project1 to C:\Users\xxxx\project1
This more likely because you do not have full right control for that particular folder you are trying to publish
steps:
1)right click on folder you are trying to publish
2)go to security
3) click on edit and add your current user login like (domain\username)
4)click on the checkbox on full control and save it
5)then try to publish
I had the same issue, when publishing got the error :
System.AggregateException: One or more errors occurred.
---> System.Exception: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ------> (Inner Exception #0)"
Solution : in file explorer the share drive target of the publication was disconnected. After reconnecting the drive the error disappeared and publication went ahead.
I solved same issue removing a folder ("node_modules") from my project. Inside this folder path was too long
Download LastVersion of MSBUILD Tools.
Build your Project and select Build + IntelliSense in Error List and show message Error if exist .
and Download System.Reflection.Emit from Nuget
try again publish your project.
Take a look at FolderProfile.pubxml file located in YourProject\Properties\PublishProfiles and make sure term is configured with correct version.
There are many causes for this problem. I already had the IIS web site configured, as well as the right permissions for the user. Obviously the project built successfully on my local machine. The problem was I added the absolute windows path on 'Site path' section in VS publish profile. Leave this empty!
I faced the same issue while trying to publish to an Azure App Service.
For me, closing Fiddler solved the problem.
After I export my Unity project to Android Studio I cannot create release build (but it works perfectly for debug build)
I have next error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: io/fabric/unity/android/BuildConfig.class
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
It caused by this two lines in my build.gradle file:
compile project(':fabric-init')
compile project(':fabric')
So, if I comment one of them it works good, but I need both of them
in 'fabric' I have io/fabric/unity/android package name
in 'fabric-init' I have io/fabric/sdk/android package name
So, package names are different.
So why I have an error when using both? Can someone help me, please?
I got the same problem and when I add "minSdkVersion 19" to build.gradle it worked for me, but this means %73.9 of Android devices can run the app.
android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
multiDexEnabled true
}
}
I have now had an error with VS2013 and WP8.1 silverlight for a couple of days.
I get a couple of different errors, ..Ensure unlocked screen.., AgHost.exe could not be launched, port is in use by another program and ensure the device is unlocked.
These errors came suddenly after I retarged the solution. I have no compiling errors.
Solution Attempts
Restart PC
Restart program
unregister and reregister the phone
reinstall Update 3
reinstall VS2013
Windows Phone 8 Application crash once its launched AgHost.exe' has exited with code -532265403
Install VS2015 with no luck.
reinstall VS2013 Update 4
Nothing worked. The error is also the same for emulator as well as different devices. I can however get the release mode installed. Break points can be used when using release mode, but I have to Clean, Rebuild and then deploy for every time I want to deploy the application. Further the deploy time has gone up exponentially. Before upgrading I used a maximum of 10 seconds. Now it is above a minute in wait time. :/
Anyone has a solution for this ?
Extra
If I run the solution before upgrade on device or Emulator It spins up with debugger. If then go to the updated WP81, I get a popup with info Something is taking longer then normal and then it crashes with ..Ensure unlocked screen.. :/
Could it be an issue with the differen SDKS?
During a repair of all the SDKs, I found an issue with the event log, which I cleared based on The Event Log File is full
Still no success.
Extra
I cannot spin up the emulator from VS2013, when using the WP8.1 solution, but the wp8.0 solution in the same VS works :S
I found an error in a log file, from:
The errors are:
[0F08:14A8][2015-07-23T09:11:44]: Applying execute package: silverlight5_DRT, action: Repair, path: C:\ProgramData\Package Cache\DEB5078B60B74431E2830831EB48DF129CB32932\packages\Silverlight\5.0_DRT\Silverlight_Developer.exe, arguments: '"C:\ProgramData\Package Cache\DEB5078B60B74431E2830831EB48DF129CB32932\packages\Silverlight\5.0_DRT\Silverlight_Developer.exe" /q /ignorewarnings'
[0F08:14A8][2015-07-23T09:11:45]: Error 0x800705de: Process returned error: 0x5de
[0F08:14A8][2015-07-23T09:11:45]: Error 0x800705de: Failed to execute EXE package.
[0550:0E74][2015-07-23T09:11:45]: Error 0x800705de: Failed to configure per-machine EXE package.
[0550:0E74][2015-07-23T09:11:45]: MUX: Installation size in bytes for package: silverlight5_DRT MaxAppDrive: 0 MaxSysDrive: 0 AppDrive: 0 SysDrive: 0
AND
[0F08:14A8][2015-07-23T09:16:16]: Applying execute package:
{312d9252-c71c-4c84-b171-f4ad46e22098}, action: Repair, path:
C:\ProgramData\Package
Cache{312d9252-c71c-4c84-b171-f4ad46e22098}\VS2012.4.exe, arguments:
'"C:\ProgramData\Package
Cache{312d9252-c71c-4c84-b171-f4ad46e22098}\VS2012.4.exe" -repair
-quiet -burn.related.patch' [0F08:14A8][2015-07-23T09:16:23]: Error 0x80048bc7: Process returned error: 0x80048bc7
[0F08:14A8][2015-07-23T09:16:23]: Error 0x80048bc7: Failed to execute
EXE package. [0550:0E74][2015-07-23T09:16:23]: Error 0x80048bc7:
Failed to configure per-machine EXE package.
Anybody knows what to do with this? The error is coming when I repair Windows Phone SDK 8.0
There was a post-VS2013 update for the Windows Phone 8.1 SDK, some odds that you don't have it installed since you did not need it before. The download location is here.
Getting error messages like "port is in use" when there's no obvious reason why it should be in use and seeing excessive download times is also a very strong selector for your installed anti-malware product getting in the way. No specific advice on how to configure it when we don't know what it might be. You definitely first want to try to temporarily disable it so you can identify it as the source of the problem.
I have no Idea of what is the issue, but creating a new solution and importing the existing projects into a new solution has solved all the issues regarding emulator and debugger an AgHost.
Seems like the upgrade function integrated in the solution did not work properly.
I made a Windows app and done changes to it but when I start debug(run) the app, following error occurred can someone help please.
Error 1 Could not write to output file 'c:\Users\MuhammadAshbal\Documents\Visual Studio 2012\Projects\Hotel\Hotel\obj\Debug\intermediatexaml\Hotel.exe' -- 'Access is denied. ' c:\users\muhammadashbal\documents\visual studio 2012\Projects\Hotel\Hotel\CSC Hotel
I tried many ways but in vain.
Try below:
a) Open VS as administrator and then build and run.
b) open project folder, check property of folder, un-check read only option and then try building solution.
i created a program in c# and used SQL server 2008 as database and installshield for program .exe package
everything works fine i mean program can be installed normally and there is no error in database or in setup
but when i try to open program it gives the following error(program signature) which i took screenshot of error
i use dotNetBar.dll in my project and its included in setup folder
i changed path of installation and database folder but still the same error
Error screenshot part 1:
Error screenshot part 2:
please help.
The error is the FileNotFoundException, your program is trying to open a file that's not there and you're not handling it in the code.
Have you copied everything?