Copying app source to another folder before running "dnu publish --no-source" results in a bogus .dll being published which causes "ambiguous route" errors
Steps to reproduce (on Mac):
Create a project with a controller called StatusController and a default HttpGet route, then run the following commands in a terminal:
cp $app_src /app_src_copy cd /app_src_copy dnu publish --configuration Release --no-source --out /app_dest cd /app_dest/approot ./kestrel --server.urls http://localhost:5000 curl http://localhost:5000/status
Result: Ambiguous route. If you run the following command then you will see why:
grep -R "StatusController" /app_dest
You will notice two matches, including one in a file called "app_src_copy.dll".
If you repeat the above steps but replace "app_src_copy" with the name of the project, then everything works fine and you won't see the bogus .dll file.
I ran into this problem while trying to create a production-ready docker image for my project.
Currently, the assembly name for a project is always the name of the immediate parent folder of the project.json file. We're looking at changing that, but for now that's the restriction. You could work around this restriction by copying the app code to a new location while preserving the parent folder path. For example:
cp MyApp MyAppCopy/MyApp
dnu publish ... MyAppCopy/MyApp --out ...
Thanks for the quick response.
I know my situation doesn't apply to everyone, but I don't actually care what the assembly name ends up being. I just don't want that duplicate .dll to be created which results in ambiguous routes. They seem like separate issues to me. That being said, more control over the assembly name would definitely be a plus.