Referenced Project Different Output folder - asp.net

I have a web site project with three referenced project. The question is really simple. For the refereneced project (say Project A and Project B referenced from Web Site Project). All I want to do is to reference it in the Web Project but I don't want it to copy to the 'Bin' folder of the web site project. I want it to copy to a folder that I define. Is there a way to do that? Many thanks.

I'm pretty sure you cannot change the ouput path if you build the referenced project. You can change the properties of the reference in the node references by right-clicking => properties, there is a property called copy local which will prevent the copy in the /bin folder. This means you will always reference whatever version of the dll is being pointed at in the Path property

Related

TFS 2005 version control DLLs in the bin folder?

I noticed that the DLLs in the bin folder for asp.net websites do not seem to be getting saved. When I goto a new computer and get latest I am missing the DLLs.
What is the correct way to fix this ? Should I create a seperate folder to contains all DLLs ? And then can I somehow tell my bin references to goto that folder to get the DLLs?
If you are using third party dlls, you should absolutley consider putting them into TFS...
If those dll comes from another project from the same solution, you should not put them into TFS.
If you use a base class library in multiple solution, I would consider using the build functionality that TFS offers. You can access your latest build from a network share (add this share as a trusted source) or directly access those dll files from TFS source control.
EDIT: you can always go back in time in tfs without having to save whats compiled....
You do not want to check your compiled .dlls in with your source control. If you have other dlls that are not directly compiled by your application then you should create a library folder in your directory structure that contains then, and check that folder in.

App_Code folder in ASP.NET project in VIsual Studio 2010

at vs2008 i could set App_Code folder, but at vs2010 i can not do it, that's why i put my dataset's and class' to App_Data folder. Either I do not know even App_Data folder is secure? Any suggestions?
Thanks
Remember, that Web Site Project can contain App_Code folder and Web Application Project can't! Because all project is for code.
If you want to add the App_Code folder, you have to manually add the folder.
Add->Add New folder--> you have to give it the folder name "App_Code"
when you do it, and vs2010 automatically will change its folder type.
good luck
If you want to use standalone class files (in "App_Code" dir) in VS 2010 project, be sure set the File Properties > Build Action for each *.cs or *.vb file to "Compile" in the Properties > Advanced dialog.
Also, use the same namespace as your project and these standalone classes will be readily available to the rest of your project.
Took me a bit to realize the default setting in my VS was "Content" instead of "Compile."
Have you tried right-clicking on the project in the Solution Explorer, selected 'Add...' and looked under ASP.NET folders?
From memory, even previous versions of VS don't automatically put the App_Code folder in your project by default.
If you just create a folder called App_Code it will recognise it as the App_Code you want, it is strange that in the add .net folder it doesnt appear.
This the route I took for it, and it all works fine.
Workaround:
If we are using App_Code in a web application project, we need to
rename into any other folder name.
http://blogs.msdn.com/b/chiranth/archive/2014/02/19/visual-studio-2012-unexpected-behavior-crash-and-irrelevant-errors.aspx
I hope this will help you - the .cs files should not be placed in a folder. Just put them in the project, alone, and not in a folder. Then your classes will be visible. This is a difference in VS 2010.

SubWebFolder and mutliple bin folders with Website model?

I am looking for some advice on how what is the best approach to subweb folders and having mutliple bin folders in the WebSite Project model. For adding new pages at a later stage without recompiling the core files of a website and without building a full fledged Plug-in framework api. I am aware of being able to drop in the compiled dlls into the main bin folder and to just copy over the new page files to a sub folder but I am looking for a more organized file/folder approach.
Here is the how it was done with WAP:
Moving the Code-Behind Assemblies/DLLs to a different folder than /BIN with ASP.NET 1.1
Multiple /bin folders in ASP.NET
I should also mention that I see that I can still do it the old way with the website project model by making the adjustment to the config section mentioned here but I was wondering if that has any side affects.
AssemblyBinding in Web Config and XMLNS
Are you trying to copy new DLL's or new sources to your site? Note that for sources, the best place in web sites is the App_Code folder. In there, you can create any arbitrary folder structure that you like, and it will all be built at runtime into an assembly. Then, every page gets a reference to that assembly and is able to use types from there.

Why does ASP.NET web site reference assembly from GAC, when adding local reference?

When you use ASP.NET web site (instead of web application model) and add reference to an assembly from local folder, Visual Studio, it seems, understands that this local assembly is also in GAC and so does NOT copy this assembly to bin folder (as it does with non-GAC assemblies), but simply adds new record in web.config file.
Why such a behaviour? Is it possible to force copy to bin folder (I need this since .dll is not on target environment)? I can add assembly to bin folder as file and it will work, but in this case bin folder contents will be in source control, which is not good.
You can set the Copy Local property to True on the reference. That should add it to the bin folder - on a Web Application project.
But for a Web Site project, when you add a reference, all it does is add a line to the web.config that references the assembly. It will look for this file first in the bin folder, and then in the GAC if it is not found.
You have two options: require the assembly to be installed in the GAC on the target machine (in which case, XCOPY deployment is not possible) or include all required assemblies in the bin folder, either by copying them in or writing a post-build script that does so. You can find the .dll by using the command prompt and going to c:\windows\assembly\GAC, find the assembly you are interested in, cd into that directory and then cd into the directory with the version you are interested in. This will give you the path to use in your post-build script. For example, for the Accessibility assembly in the GAC, you'd end up with this path:
c:\Windows\assembly\GAC\Accessibility\1.0.5000.0__b03f5f7f11d50a3a\Accessibility.dll
You say including the bin folder contents in source control is not good. This is generally regarded as true for binaries you build, but in your case, you have binary assets that are not compiled as part of your project. Philosophically, these are equivalent to images: binary assets not compiled as part of your project. I would argue they belong in source control as much as any other binary your project relies on. But it is a personal choice.
If you are using a website project in Visual Studio and a reference keeps pointing it to the GAC version instead of some other folder (eg lib), you will need to create a xxxx.dll.refresh file in your /bin folder, where xxxx is the offending dll you are referencing.
This will resolve build problems with MSBuild too where the server will expect the dll to be in the GAC. The .refresh file will get the file from the correct relative path to do builds correctly.
At run time, assemblies must be in one of two locations: the output path of the project or the global assembly cache (see Working with Assemblies and the Global Assembly Cache). If the project contains a reference to an object that is not in one of these locations, then when the project is built, the reference must be copied to the output path of the project. The CopyLocal property indicates whether this copy needs to be made. If the value is true, the reference is copied. If false, the reference is not copied.
The project-assigned value of CopyLocal is determined in the following order:
If the reference is another project, called a project-to-project reference, then the value is true.
If the assembly is found in the global assembly cache, the value is false.
As a special case, the value for the mscorlib.dll reference is false.
If the assembly is found in the Framework SDK folder, then the value is false.
Otherwise, the value is true.
Hope this helps
s
For information on how to set the Copy Local Property of a Reference for a web project (not a web application), see:
http://msdn.microsoft.com/en-us/library/t1zz5y8c(v=VS.100).aspx

Web Deployment Project builds files that are no longer part of the project

This is the error I get:
Error 101 Could not load type
'control'. /Test.vbproj/x.ascx 1 1
WebDeployProject
This is a left over file that was part of the project last week, but one of the developers deleted it from the project. I have to manually delete the file in order to get the WDP to build. Is there a way to tell the WDP to ignore the files that are not part of the project or to see that these files are not part of the project and delete them?
You'll need to use your source control tools to find and remove local files that aren't under source control.
For instance, if you're using TFS, do the following:
Open Source Control Explorer (View -> Other Windows -> Source Control Explorer)
Right-click on the path in TFS that corresponds to your local working copy and select Compare
Use your TFS path as Source Path and your local working copy as Target Path
Under View Options, select "Show items that exist only in target path"
You've now got a list of all the files that exist in your local working copy but aren't in source control. For each file, either delete your local copy or add it to source control.
It could have something do to with the type of web project is it.
If it's a web site, then the compiler will attempt to compile every file in the folder. However, if it's a Web Application Project, then it will only compile those that you've specifically added as part of the project.
If you have recently deleted/removed a file from your project then you need go to Project > "Show all files" and all removed files will apear in your solution explorer. You can delete the file, /x.ascx and rebuild your WDP.
It has nothing to do with the type of Web project: http://amiraryani.wordpress.com/2008/11/06/web-deployment-project-aspparse-could-not-load-type/.
A Web Site itself considers files under its root directory as part of the site.
A Web Application Project itself allows you to customize build actions, etc. on a per-file basis.
A Web Deployment Project, however, will try to include files under the root directory (a la a Web Site), even if the WDP is associated with a WAP. That's why it doesn't matter which kind of Web project it is.
EDIT: To clarify, it would matter what type of Web project you are using if you were trying to Build, Debug, or Publish that project itself instead of using a WDP.

Resources