I have been building and rebuilding an ASP.NET program.
I made the horrible mistake, I think, of recently copying the published content back to the folder I was developing.
So now I have an unusual error when I build the code. It says That there is a duplicate definition in one file in a temporary directory with anohter file in a temporary directory.
Error 3
The type 'ChildEventHandler' exists in both
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files...\b90cc7a4\28d266b\assembly\dl3\c4cf1ea3\b6e4b808_ef7cce01\App_Code.DLL'
and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files...\b90cc7a4\28d266b\App_Code.asx5jp5d.dll' C:\inetpub\wwwroot...\Resources\usercontrols....ascx.cs 11 18 C:......\
I removed project and file names, of course, but this is basically what the error says.
Since the error is with temporary files, what should I do?
I do not see a "clear" option in visual studio to clear out the files of a compile.
This problem I faced sometimes back while compiling. Go to this folder
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files and delete all the files and folder under it. When you build an application which is not hosted under IIS, temporary debug files and folder get created under this folder.
It may happen that you get an access denied error while deleting them. Close your Visual Studio solution and delete everything under this folder. It will resolve the compilation error.
For those using Visual Studio 2015 in Windows 8 or Windows 10, the solution is to remove all temp files from the following location:
%AppData%\Local\Temp\Temporary ASP.NET Files
and then rebuild your Solution.
In my case, the error is come from some cshtml files that are under project folder but not included in project. So if you search the error in entire solution, it couldn't be found. You can use show all files to show the not included files, and try to open them to find the possible files that cause the error.
If you haven't got the option of "Clean Solution" (maybe Express verions, or pre-2010 don't have this?) then, to fix this error, simply go to the /bin folder of your solution and delete all items, then Build again.
This will recompile all the DLL files.
Related
I'm using Visual Studio 2019. I created a project and then decided that I didn't need it and removed it from my solution. The solution builds successfully. However, when I run the remaining projects, I get this error message in the YSOD:
The type or namespace name 'RemovedProject' could not be found. Source
File: c:\Users\%user%\AppData\Local\Temp\Temporary ASP.NET
Files\vs\63f72506\347f2602\App_Web_index.cshtml.ce0b5a11.bhx-cdpd.0.cs
If I delete the file, then it just appears back with the same reference but with a different extension before the 0 (ce0b5a11.bhx-cdpd in this example). VS is generating that file with that reference for some reason.
I've tried deleting the .vs folder in the solution folder, as well as the bin and obj folders of the remaining projects. I also deleted the temporary files in C:\Users\\%user%\AppData\Local\Microsoft\VisualStudio\16.0_08106da7\ComponentModelCache after shutting down VS, but that did not resolve the issue.
Any ideas on why VS keeps generating that file or how to resolve this issue?
Installed VS2017 from scratch and moved existing vb.net, c# webform solutions to the new laptop.
First issue was related to "The target GatherAllFilesToPublish does not exist" error which I fixed by opening vbproj (or csproj on another project) and add this line:
<Target Name="GatherAllFilesToPublish">
</Target>
Now I was able to publish with no errors but the output in the destination folder is the entire solution including .aspx.vb or .aspx.cs files, .Global.asax.vb, .aspx.designer.vb files etc.
Checked the project Package/Publish Web settings and Items to deploy is set to "Only files needed to run this application".
Still the publishing copies the entire solution instead only the aspx, dll and only what is needed. Any idea what I am doing wrong ?
Edit csprojfile,in that file change vs version of your old project to vs 2015 in property group.save the file and rebuild .it will work properly.
I have just integrated another project pages and its dlls into my existing project's Bin/ folder. My project framework is 3.5. When i am trying to build the project or solution, it's throwing following error:
"The type 'ASP.global_asax' exists in both 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\timesheet\15a75c54\898b48b9\assembly\dl3\58b062b2\00ceda54_c98cc801\App_global.asax.DLL' and 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\timesheet\15a75c54\898b48b9\App_global.asax.q_h6dbfx.dll' c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\timesheet\15a75c54\898b48b9\App_Web_admin.master.fdf7a39c.zecazgwd.0.cs
"
Setting "batch=false" into web.config's is not working. I have also tried to delete all folders from "c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\", then clean and rebuild soultion. But still it's not working.
In my case the problem occurred in a virtual application's bin folder. Looking into this bin-folder you will probably see two files (an information I found here):
App_global.asax.dll
App_global.asax.compiled
Removing these resolves the error. The App_global.asax.dll is generated at runtime too which causes the problem. I am however still investigating how these files got there, so comments are definitely welcome!
I suggest you go to the path: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files and clear the all the temporary files of your application, build your solution, and then run it!
In my case the problem was caused by accidentional removal of "PrecompiledApp.config". As soon as i returned the file everything started working normally.
I struggled with this issue in .NET 4.5 in VS2013 for a while before finding a solution that worked:
Manually deleting the contents of the ASP.Net project's bin-folder. Clean/Rebuild was insufficient. It didn't delete enough apparently ;)
The error persisted after adding the batch="false"attribute in the compilation-element of web.config.
It also did not help to delete the ASP.Net Temporary Files-directory either.
In my case, i have added in my folder bin a file with name
"App_global.asax.compiled"
delete only this files and its work.
What worked for me was
Remove the TARGET BIN folder or empty that folder completely, and then put the newest version of your BIN folder.
Why: In my case after publishing the BIN folder to my "hosting provider" FTP server, the BIN folder was not overwriting the files that needed NOT to be there in this case those mentioned above App_global.asax.dll
App_global.asax.compiled
SO by overwriting the whole BIN folder, we assure that the BIN folder is a brand new
this worked for me...
In my case, to solve the problem, I needed to disable the "PrecompileBeforePublish" and delete the bin folder as the image below.
My problem was I referenced .net standard project on my .net framework project, not sure where it got conflicted.
I just Clean Solution and Build Solution then solved!
Have got recently the same error when publishing site from debug PC onto the server.
Changing option to true solved the issue.
<DeleteExistingFiles>True</DeleteExistingFiles>
file ~\Properties\PublishProfiles\FolderProfile.pubxml
In my case I have added DLL from local to stage site.This works for me.
I am in need of some help.
I tried this on Visual Studio 2008 and 2010, and I am getting the same error.
I have a solution that I have been working on and I went to add a new class file to a project and I got the following error:
Access to the path "C:\Temp\yiswy0sj.5lo\Temp\Properties\AssemblyInfo.cs"
The previous error is slightly different, every time I try and create a new project, in the temp folder that it is creating. I went to the temp folder, and the assembly file is there, it is hidden and it has the correct assembly file info in it.
I am not able to add new projects or class files to any of my solutions.
I did quite a bit of research, and someone said to change the temp folder. I tried this as you can see the temp folder is not app data any more, it is Temp; and this did not solve the problem.
Any assistance would be appreciated. Any questions I will be more then happy to answer.
Thank you for your time.
I know how to fix the issue. Under your program files (x86) flag all your Microsoft Visual Studio directories and files as NOT Hidden. You have/had a virus that hid your files and this is causing the AssemblyInfo.cs in the temp folder to appear hidden as well.
despite the error is in c:\ you have to unhide the visual studio directory which is my case is D:\Archivos de Programa\Microsoft Visual Studio 9.0
the virus is check system, it simulate a hard disk fail, malwarebytes ged ride of it
I'm trying to publish project (tools vs2010), but cannot all the time getting the error below.
I paste to my projects files from another project and then I changed namespace (OldProjectName) to the parent project (NewProjectName). But it still getting information from somewhere about old project.
I cleaned solution, builded, rebuilded. Closed and reopened again and all the time the same error.
I'm able to build project but publish it.
Any ideas what can cause the problem?
Error 1 Copying file
obj\Debug\OldProjectName.csproj.FileListAbsolute.txt to
obj\Debug\Package\PackageTmp\obj\Debug\OldProjectName.csproj.FileListAbsolute.txt
failed. Could not find file
'obj\Debug\OldProjectName.csproj.FileListAbsolute.txt'. 0 0 NewProjectName
Open your .csproj file in notepad
Find "obj\Debug\OldProjectName.csproj.FileListAbsolute.txt"
Remove that line and save it
Open your project and try to publish it and this time you will be succeeded.
Note: if you are getting any more file like .pdb remove that as well.
Hope it will help you
Make sure the obj folder is not read only, if so change read only property of this folder to false. this worked for me.
Check the permissions to the folder obj\Debug\ if you give it write permissions, the error would go away.
Check if the folders "bin" and "obj" are checked-in to source control, if so delete those two folders in source control. There is no need to check-in these two folders to source folders. Also make sure that these folders "obj" and "bin" are deleted from your hard disk, they will be created again after a build.
Hope this will fix your issue.
It is your responsibility to make copies so you can go back to one.
Open your project file (vb/cs)proj with a notepad, and search for the missing files.
In my case I got this error when I tried to publish the project and certain files were not found.
Each publish attempt I got another file name, after checking that the file actually didn't exist in the project, I removed it from the project file, manually.
Then publish succeeded.
Delete the obj folder and build again.
Ref: http://forums.asp.net/t/1402005.aspx
Like many others these files were read only and needed to be deleted or actually able to be overwritten by VS. However, as may be the case for many others, the problem was because these files were checked in to source control. Your bin and obj folders should not be in source control. Mark them for delete and submit the changelist.
One exception to the rule is for the bin folder could be dll files that are not .Net compatible. Such as a C/C++ dll that you are using through a .Net wrapper dll. I mark them as content so that they get published and check them into source control.
I too had this problem. I resolved this by deleting files inside project bin folder (.dll and .pdb) and closed and re-opened VS .
The file named FileListAbsolute.txt was deleted from the folder obj/debug. Visual Studio can automatically recreate the file and others in the obj/debug for you.
For VS to recreate it, set the configuration of the solution and the project to debug mode. Then rebuild your solution.
To change the configuration mode to debug, from the solution explorer, right-click on the solution name and select Properties.
Select Configuration under Configuration Properties. Then select Debug from the dropdown list.
Click Apply and OK. Ensure that in Configuration Manager, the configuration mode is also a debug mode.
Then rebuild your solution.
For me using solution here: Certain Razor views not publishing
Excluding the views folder and re-including fixed it for me. So it's possible for anyone else experiencing this it may be as simple as excluding and then including the file/folder in question of your project.
I encountered this bug using VS2017 with a solution stored in OneDrive.I suspected OneDrive's sync mechanism to be the root cause of this.
When I tried to reproduce using VS2019 however it did not reappear. Looks solved in between these versions.