Difference in how Visual Studio & MSBuild treat the OutputPath of Web Application projects
I am using VS 2010 web-application project. I want to change the default OutputPath property of the web-application to a directory elsewhere. This does not seem to be entirely working when I have an other project in the solution:
FIRST:
- Create a blank web-application project, WebApplication1
- Change the OutputPath in the project's properties from
bin
toc:\binaries
- Right-click on the project in solution explorer, and build.
Everything works as expected, and WebApplication1.dll
is copied to the c:\binaries
.
THEN:
- Add a class library to the same solution, ClassLibrary1
- Add the class library as project reference to the web application.
- Right-click on the web-application project in solution explorer, and build.
Both ClassLibrary1.dll
and WebApplication1.dll
are copied to c:\binaries
, but now there is a WebApplication1\Bin
directory created which contains only ClassLibarary1.dll
QUESTION:
Has anyone encountered this before? The only reference on the web I found was this, with no answer. Appreciate any way to disable creation of the Bin
folder.
MORE INFO
This only happens when building from inside visual studio. If I use
msbuild WebApplication1.csproj
, this mysteriousBin
directory is not created.I dug through the msbuild logs, but to no 开发者_如何学编程avail. I could not find any property pertaining to that path. The capital
B
forBin
is also strange, all paths when used in msbuild are usuallybin
.Last I removed the
WebApplication.targets
file Import from the web application's proj file but it did not make a difference. In fact, looking at the msbuild logs, there do not seem to be any targets from the WebApplication.targets getting executed.
Your web app has default output path the same as the webapplication1 project dir. Bin catalog is used internally by your site to find where dependent assemblies are (see probing). By Default Microsoft.Web.Publishing.targets uses it to copy all dependent asseblies locally.
Full web app output is a site with *.aspx, .js, web.config, bin\.dll-files and so on. To make it copy to your c:\binaries directory specify OutDir instead. But as a result you will get the full site under the path c:\binaries\_PublishedWebsites\WebApplication1. And _PublishedWebsites subfolder couldn't be renamed.
It seems that this default behaviour is very strict. You can see internals of build targets at C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets.
EDIT: If you really don't want to see bin catalog just ignore it in svn/git/... .
精彩评论