Error when publishing Migrated ASP.Net web application with framework 4.6.2 - asp.net

We have a requirement to migrated the ASP .Net web app from .Net framework 3.5 to 4.6.2. I have migrated the application to frame work 4.6.2 and able to run the application.
problem comes here when publishing the code. I am getting an error:
Copying file obj\Debug\Project.dll to obj\Release\Package\PackageTmp\obj\Debug\Project.dll failed
in migrated (frame work 4.6.2) code, however i don't see any error when publishing the old code(frame work 3.5).
i have tried many things:
delete the Obj folder from the solution
ran msbuild.exe command to publish (custom msbuild xml)
restarted the IDE(VS2015)
restarted machine
What else should i do?
Error
When tried from VS : Publish
Error Copying file obj\Debug\Project.dll to obj\Release\Package\PackageTmp\obj\Debug\Project.dll failed. Could not find file 'obj\Debug\Project.dll'
When tried from custom msbuild
Build FAILED.
"\Build1.xml" (default target) (1) ->
"project.csproj" (default target) (2) ->
(_CopyWebApplicationLegacy target) ->
C:\Program Files\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microso
ft.WebApplication.targets(182,5): error MSB3030: Could not copy the file "js\id
le-timer.js" because it was not found.
C:\Program Files\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microso
ft.WebApplication.targets(182,5): error MSB3030: Could not copy the file "js\jq
uery-idleTimeout-iframes.min.js" because it was not found.
0 Warning(s)
2 Error(s)

Here are the steps i followed to solve this issue
Upgrade all the dll's (non solution dll's) with nuget package manager along with the solution migration from 3.5 to 4.6.2 framework.
Remove un-used dll's from the project
rebuild and publish!!
My issue resolved after following the above steps.
Thanks

Related

.NET Core 3.1 application not building on Azure pipeline anymore (.NET 5)

Until recently our .Net Core 3.1 applications were building and publishing fine on Azure pipelines. But over the last couple of days the build pipelines have started to fail with the error:
##[error]C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5):
Error NETSDK1005: Assets file 'D:\a\1\s\ProjectFolder\src\Project\obj\project.assets.json' doesn't have a target for 'netcoreapp3.1'.
Ensure that restore has run and that you have included 'netcoreapp3.1' in the TargetFrameworks for your project.
(ResolvePackageAssets target) ->
C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5):
error NETSDK1005: Assets file 'D:\a\1\s\ProjectFolder\src\Project\obj\project.assets.json' doesn't have a target for 'netcoreapp3.1'.
Ensure that restore has run and that you have included 'netcoreapp3.1' in the TargetFrameworks for your project. [D:\a\1\s\ProjectFolder\src\Project\Project.csproj]
The build pipeline is setup as follows for the solution build step that is failing.
Any ideas how to resolve this with the least amount of change?
.NET Core 3.1 application not building on Azure pipeline anymore (.NET 5)
Please try to update the nuget.exe to the 5.8.0 by the task NuGet tool installer:
You could check this thread for some more details.
had the same problem with a local build agent
error NETSDK1005: Assets file 'project.assets.json' ....
Update NuGet.exe to the 5.8.0 version or above
and clearing NuGet cache:
dotnet nuget locals all --clear
Download Nuget
found here

Running Angular 4 + Core 2.0 on IIS failing to start up

I have an application written in ASP.Net Core 2.0 using the Visual Studio Angular 2 template that I can run successfully on my local IIS installation and local commandline but fails on Windows Server 2012 R2 Standard.
From my local command line I can run:
dotnet myApp.dll
And the application runs successfully until ASP.Net core 2.0. When I copy the deployed application to my 2012 server (where the Core 2.0 runtime as been installed), I cannot call the same dotnet command (both calls are from within the root deployment folder for the app myApp).
On my desktop, the result is a web site that is listening at 5000 (ASP.Net core 2's default port I'm assuming) when running from the published site locations.
However, when I run this same command on the server, I get the error:
Unhandled Exception: System.AggregateException: One or more errors occurred. (We
bpack dev middleware failed because of an error while loading 'aspnet-webpack'.
Error was: Error: Cannot find module 'aspnet-webpack'....
....
....
) ---> Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException:
Webpack dev middleware failed because of an error while loading 'aspnet-webpack'
. Error was: Error: Cannot find module 'aspnet-webpack'
When I look up aspnet-webpack from npmjs.com, I note that this module is "This NPM package is an internal implementation detail of the Microsoft.AspNetCore.SpaServices NuGet package" according to NPM.
I'm assuming that somehow my Core 2.0 install in missing or not able to reference Microsoft.AspNetCore.SpaServices, but at this point I'm not sure where I should be looking for this.
Thanks for any input.
Look at your system variables (right click My PC > Properties > Environment Variables). ASPNETCORE_ENVIRONMENT has to be set to either Staging or Production if you do not have the dotnet sdk installed.
Once you change that value, change it in your project (Properties > Debug tab) as well. Redeploy your project and restart your server. You should see the site working now.
Good luck!

VSTS Build failing - Error : Web deployment task failed

I have a build definition in Visual Studio Team Services (previously Visual Studio Online) to build an ASP.NET web application using an on-premise agent. The agent has VS2012 installed and all the other necessary prerequisites to assist in building the application. However, when running the build, it fails and outputs below error:
C:\Program Files
x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4021,2):
Error : Web deployment task failed. (The .zip file package
'C:\BuildAgent\_work\1\a\' must be a file, not a directory.)
Process 'msbuild.exe' exited with code '1'.
I tried building the project on the agent machine using VS2012 and it builds fine. Also, I have defined following MSBuild parameters in the build definition which is same as my other builds that use a hosted agent:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
What could be the cause of this issue? Do I need to install anything extra?
You are using VS2012, you need to specify detail PackageLocation argument with .zip suffix ($(build.artifactstagingdirectory)\testWeb.zip). If you are using higher version of VS/MSBuild (e.g. vs 2015), a folder path is ok, it will adds [XXX].zip to the end of that path.

Any luck with building ASP.NET 5 beta 7 application on VSO?

I'm trying to build ASP.NET 5 beta 7 application on VSO. And I getting following error:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DNX.PackageManager' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.DNX.PackageManager'
I know about this issue:
https://github.com/aspnet/Announcements/issues/51
So I tried to install latest WebTools using PowerShell script but "access denied".
Any ideas how to build beta7 app in VSO? Or just wait unit VSO build server will be updated with latest tools?
In order to build ASP.NET 5 beta 7 project successfully, the Microsoft ASP.NET and Web Tools 2015 (Beta7) – Visual Studio 2015 needs to be installed.
However, this web tool is not available on hosted build server, that is the reason why you get the "FileNotFoundException" error message (please check this link for the details what are installed on hosted build server: http://listofsoftwareontfshostedbuildserver.azurewebsites.net/). Additionally, you're not allowed to install any software to hosted build server, so, you get the "access denied" error message.
So, in order to build ASP.NET 5 beta 7 project successfully, instead of using hosted build server, you need to set up to use your own on-premise build controller. Check this link for the details: https://msdn.microsoft.com/library/ee330987
This is a result of the tooling changes for Visual Studio 2015 and VSO not having the latest tools installed in its hosted build controller (specifically, Microsoft.Dnx.PackageManager doesn't exist and should actually be Microsoft.Dnx.Tooling). To get around this, besides hosting your own build controller, you can fall back to the command line tools dnu build and dnu publish:
dnu build "src\{YOUR.PROJECT.FOLDER}" --configuration "release"
dnu publish "src\{YOUR.PROJECT.FOLDER}" --configuration "release" --out "your\output\directory\to\publish\to" --runtime "dnx-clr-win-x86.1.0.0-beta7"
I have this mostly detailed on my blog here: Deploying ASP.NET 5 Beta 7 Through Visual Studio Online
This should only be a temporary issue, as one can only assume Microsoft will be updating their tooling. When that's complete, you should be able to go back to the normal Visual Studio build step.
Seems that you've renamed PackageManager incorreclty. Just find where you have reference to 'Microsoft.DNX.PackageManager' and change it to 'Microsoft.DNX.Tooling'

Getting MSBUILD working with an ASP.Net website in Jenkins

Introduction
My asp.net website with C# builds (& publishes) perfectly on my development machine.
The solution uses .net framework 3.5
I use Visual Studio 2008
The website contains a bin folder with the AjaxControlTollkit dll
The issue
I am attempting to set up Jenkins for continuous integration
Jenkins is running on a windows server 2008 r2 based machine
I am referencing the SVN repository and all the code appears to get checked out correctly.
The build fails with the following error:-
Build started 10/09/2014 13:20:02.
Project "D:\DEV\Manzen_fx_35\Manzen.sln" on node 0 (default targets).
Building solution configuration "Debug|Any CPU". Manzen_fx_35:
Copying file from "D:\DEV\Manzen_fx_35\bin\AjaxControlToolkit.dll" to
"..\Manzen_fx_35\Bin\AjaxControlToolkit.dll". Copying file from
"D:\DEV\Manzen_fx_35\bin\AjaxControlToolkit.pdb" to
"..\Manzen_fx_35\Bin\AjaxControlToolkit.pdb". ASPNETCOMPILER : error
ASPRUNTIME: The precompilation target directory
(D:\DEV\Manzen_fx_35\PrecompiledWeb\SourceCode) cannot be in the same
tree as the source application directory (D:\DEV\Manzen_fx_35). Done
Building Project "D:\DEV\Manzen_fx_35\Manzen.sln" (default targets) --
FAILED.
"D:\DEV\Manzen_fx_35\Manzen.sln" (default target) (1) -> (Manzen_fx_35
target) -> ASPNETCOMPILER : error ASPRUNTIME: The precompilation
target directory (D:\DEV\Manzen_fx_35\PrecompiledWeb\SourceCode)
cannot be in the same tree as the source application directory
(D:\DEV\Manzen_fx_35).
0 Warning(s)
1 Error(s)
I obviously don't have to do anything in Visual Studio to get the site to build successfully.
MSBUILD is however struggling with the reference to the AjaxControlToolkit.dll & AjaxControlToolkit.pdb files and specifically to the precompilation target directory.
I've not found any other answers that seem specific enough to help.
I imagine the solution is fairly simple and is probably staring me in the face but having never used MSBUILD in isolation before (I do everything in VS) I'm a bit lost.
Here's hoping someone can help.
i would start by removing the toolkit and see what happens. but i don't think it's the problem.
i think it has more to do with, "The precompilation target directory ... cannot be in the same tree as the source application directory." looks like there is some precompilation going on and compiled files are being sent to the wrong dir; or the build should be grabbing files from the already-precompiled directory, not the source; or some variation.
look for the precompilation "routine". it would have the term, 'aspnet_compiler' in it.
I have identified the source of the problem.
As I wrote in the original post, I suspected that the answer was indeed staring me in the face and it was.
The statement "ASPNETCOMPILER : error ASPRUNTIME: The precompilation target directory (D:\DEV\Manzen_fx_35\PrecompiledWeb\SourceCode) cannot be in the same tree as the source application directory (D:\DEV\Manzen_fx_35)" identified that the precompilation target directory cannot be in the same tree as the source application directory.
I changed the precompilation target directory and the MSBUILD in Jenkins now works. Both an F5 Build and a Website Publish are unaffected.
The precompilation target directory setting is obviously not an issue when building via an F5 or the website is published in Visual Studio BUT it is if you are using MSBUILD standalone.

Resources