Answered by:
MvcBuildViews ignores OutputPath?

Question
-
User-1271967244 posted
Hi,
`aspnet_compiler.exe` ignores the value if `<OutputPath>` in `.csproj`.
It always uses `bin\`.I have this in my `web.config`:
<system.web> <compilation> <assemblies> <add assembly="DevExpress.Web.Mvc5.v15.2, Version=15.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <add assembly="DevExpress.Web.v15.2, Version=15.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <add assembly="DevExpress.Data.v15.2, Version=15.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> </assemblies> </compilation> <system.web>
When I set `<OutputPath>notBin\<OutputPath>`, and remove the `bin` folder, there will be this compilation error:
Web.config(87): [ASPCONFIG] Could not load file or assembly 'DevExpress.Web.Mvc5.v15.2, Version=15.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' or one of its dependencies. The system cannot find the file specified.
Now, when I restore the `bin` folder, but keep `<OutputPath>notBin\<OutputPath>`, `aspnet_compiler.exe` runs successfully.
I need both the system.web/compilation/assemblies section, and also the overridden OutputPath.
Does anyone know a workaround to get `aspnet_compiler.exe` working?
Monday, July 15, 2019 9:56 AM
Answers
-
User-474980206 posted
If you check the documentation of aspnet_compiler.exe
https://docs.microsoft.com/en-us/visualstudio/msbuild/aspnetcompiler-task?view=vs-2019
You will see you an set the virtual path folder (-v), but it still writes to the bin folder of this path. You should use a post build step to copy the bin contents.- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, July 15, 2019 6:39 PM
All replies
-
User475983607 posted
And the expected behavior. Can you explain why you want to change the name of the standard bin folder? What problem are you trying to solve?
Monday, July 15, 2019 11:23 AM -
User-1271967244 posted
I would expect aspnet_compiler.exe to honor the <OutputPath> property, since "bin" is just a default value for that.
Or would expect aspnet_compiler.exe (or MvcBuildViews task) to be parameterized for overridden OutputPath directory paths.The overridden output path is a legacy we have to live with.
We don't dare to change this at the current phase of the project.
Instead of having 1 big MVC project, it has been split up into independent parts (multiple little MVC projects).
These get built into the same output folder; so in the end, a big MVC project will be built.Monday, July 15, 2019 4:33 PM -
User753101303 posted
Hi,
I believe I saw once a discussion about that being not that easy and believe it was related to https://github.com/Microsoft/msbuild/issues/87 (having both OutputPath and OutDir ?)
I would :
- keep both directories until I see the old one is really not used any more
- use Tools Options to use a verbose build and perhaps better see what happens
- for now it looks like a problem with the https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/probing-element probing path ?I was not planning at looking at that as ASP.NET Core seems to have better options. If I remember you are supposed to be able to have a main MVC projects with other projects for your area(s).
Monday, July 15, 2019 5:14 PM -
User-474980206 posted
If you check the documentation of aspnet_compiler.exe
https://docs.microsoft.com/en-us/visualstudio/msbuild/aspnetcompiler-task?view=vs-2019
You will see you an set the virtual path folder (-v), but it still writes to the bin folder of this path. You should use a post build step to copy the bin contents.- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, July 15, 2019 6:39 PM -
User-1271967244 posted
Thank you all for the tips.
I tried to play around with MsBuild flags, but seemingly undeterministic random things happened, so did not dare to keep that code :)
Copying the bin contents AfterBuild and before-MvcBuildViews worked stablyMonday, July 22, 2019 10:56 AM