Building application in Visual Studio 2012 always generates unwanted dll - visual-studio-2012

I am making changes to a web forms application in visual studio 2012 and part of that change is to remove reference to an old dll. The dll is responsible for handling authentication and I have written a new class library to handle this.
My problem is everytime I build my website in the solution, it always generates this old dll. I've annotated out all references to it in the entire application and it's not in the project dependencies of the solution.
If I exclude the unwanted dll, it just generates a new one. I am completely baffled by this. It's something I've not encountered before so I am not sure what else I can do.
I'm not sure what to post so if anyone can help then that would be great.

I had a similar problem (but it was with a persistent DB file being generated). I ended up having to go through the bin from the project file and editing it from there. Some files are 'hidden' from the project, and are either visible by
Make sure you are showing all files. There is a button at the top of
the Solution Explorer called "Show All Files". To see this button,
make sure that your project is selected in the solution explorer.
or by manually going through your project files.
EDIT
It can sometimes be hidden in the Global Assembly Cache (GAC) where it can reside indefinitely. http://msdn.microsoft.com/en-us/library/zykhfde0.aspx explains how to remove it (if it is indeed hiding there).

try this, remove the old project from your Solution.

Related

Cannot delete a project reference

I'm (unfortunately) working with an old, old website type Visual Studio project in VS 2010/2012, and I'm unable to delete a project reference. When I open up the Properties Page, highlight the reference I want to delete, and click remove - nothing happens.
I've tried it in both these versions of Visual Studio and tried running as admin, and it still doesn't work. This seems like a pretty idiot proof thing to do, but somehow I can't make it work.
I figured it out (I think). The reference I needed to remove was in the web.config, and that file was write protected by source control. I checked out that file and manually removed the reference from the web.config. It is now gone.

Can you create a new project while one is open? / Is it possible to duplicate projects?

I seem to only be able to create a new project from the "Quick Start" panel. And this screen is only available when you don't have any projects open.
I know I can close all projects, create a new one, then select File >> open recent if I want multiple projects up. But is it possible to create a new project, say from the File menu while I am already in another project? The only option for creation there is for new files for the current project.
Is it possible to copy/duplicate a project without having to copy/paste the file folders and then import?
I use Android Studio on Windows, so I'm not sure whether it's any different on OSX, but the File menu does allow for creation of new projects.
The screenshot below shows the File menu while a project is open. Note the highlighted item. If this is missing for you then you may have some problem with your installation - or the OSX version is seriously different, but I doubt that.
You could try resetting your installation to default (see here for instructions). Just be sure to backup the config files (instead of deleting them) in case this does not solve your problem.
The only other thing might be different on my system is that I do not use Gradle projects, but I don't really see how that would change this behaviour - but that might be the case.

How to stop "Failed to delete the temporary file..." warnings from VS2012 compiler

I have two rather large solutions that both experience the same problem. The issue is that I am warned about an inability to delete temporary files. The messages all look like this:
Failed to delete the temporary file
"C:\Users\Don\AppData\Local\Temp\tmp07197280428445c484ba0cda58178903.exec.cmd".
The process cannot access the file
'C:\Users\Don\AppData\Local\Temp\tmp07197280428445c484ba0cda58178903.exec.cmd'
because it is being used by another process.
I have seen suggestions of using pre-build commands to first delete things, but that is a lot of projects, and I'm not going there.
Anyone know how else I might remedy this, that does not involve "fixing" each project individually?
If it makes any difference, I'm compiling C# .NET 3.5 projects.
My idea is, to write a small addin for Visual Studio, which can delete files on build. You could configure it with filepaths and then just run sth like this:
foreach (var item in paths)
File.Delete(item);
And the config you could put solutionwide.
I get that too - the problem is that the compilation system itself is holding onto the file when it attempts to delete it. I think it deletes it afterwards anyway as I've never seen the named files hanging around afterwards so its just an annoyance that can be ignored.
The files seem to be the command that VS is running that is built up from the build settings.
I assume its a .NET thing where the GC hasn't cleaned up the object that has the handle to the file when the system attempts to delete it. If so, directly shows the benefit of RAII over GC :-)
A likely source for the problem is that your antivirus software is busy scanning the file in question, which prevents the rightful owner deleting it. Curb the enthusiasm of the antivirus and your problem will be solved.
Unload the project from your solution, than reload it. It should create the missing files and be buildable again.
If you have installed any third party cleaner tool and activated the active mode (always running in background) this will lock the temp folder in the appdata so Visual Studio is unable to restore the Nuget package on build and there will be a build error.
Try uninstalling the cleaner and restarting the system. When I had this problem, that was how I fixed it.

Publishing a Web Application from VS2012 is wiping out user content

I'm attempting to use Web Deploy to Publish a Web Application.
I want Visual Studio to delete any files that no longer exist, so I've checked the "Remove additional files at destination" setting in my Publishing profile.
However, I want VS to ignore the /Content/uploads folder, as it contains contents that my users have uploaded. Naturally, the contents are different in my development site than they are in the live site.
Unfortunately, I have been unable to discover a way to make Visual Studio ignore this folder when publishing (it wants to delete all of the content, since it doesn't exist in the project).
Does anyone know of a way to exclude specific folders on the target site from being examined by Web Deploy?
I had a similar problem, wanting to keep some files in the deployment package even though they're not part of the project.
Try to create a custom MSBuild target for this, that works for me.
Here is a Getting Started MSBuild reference
Hope this helps.
All the best.
I was unable to find a suitable solution for this issue, so I've created my own:
https://pubsync.codeplex.com/
PubSync enables quick and reliable file syncing for publishing Visual Studio projects.

Missing dll when deploying ClickOnce

When I publish a ClickOnce application, one of the references that is included in one of my projects is missing.
If I go to my project's Properties -> Application Files, this missing reference is not even listed here.
My bin/Release folder has an .exe.manifest file, and I noticed it that it is also missing from here.
However, when I build the project, the DLL is in fact copied to my bin/Release folder.
How can I ensure it also deploys this required dependency?
I finally found a solution for this problem and I hope it will solve your problem to.
In my case, I'm editing an old application at work which have multiple projects, but the main project and it's back end project are the most important here.
The back end is added in the References section of the main project.
In the back end, a third party dll was imported, but this dll requires 2 other dlls.
So those 3 dlls were added in the References section of the back end project.
At that point, one of the 2 other dlls was not showing in the Application Files section for ClickOnce.
I've come up with a couple of ways of fixing it, but the most elegant one was to add this dll in the Reference section of the main project.
As stated in How to: Specify Which Files Are Published by ClickOnce, change the Copy Local property value on the reference to True.
References to assemblies (.dll files) are designated as follows when you add the reference: If Copy Local is False, it is marked by default as a prerequisite assembly (Prerequisite (Auto)) that must be present in the GAC before the application is installed. If Copy Local is True, the assembly is marked by default as an application assembly (Include (Auto)) and will be copied into the application folder at installation. A COM reference will appear in the Application Files dialog box (as an .ocx file) only if its Isolated property is set to True. By default, it will be included.
I know is this an old question, but for anybody having similar issues. I think this is a cleaner way around the problem.
I had a similar issue and everything I did to get ClickOnce to deploy with the offending .dll failed.
Eventually, I had to deploy manually.
See walk-through here.
That worked for perfectly for me. But, for the life of me, I still wonder why that process can't be added to VS (I'm using 2017 community).

Resources