dnx icon indicating copy to clipboard operation
dnx copied to clipboard

Copying app source to another folder before running "dnu publish --no-source" results in a bogus .dll being published which causes "ambiguous route" errors

Open kcraft opened this issue 11 years ago • 2 comments

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.

kcraft avatar Nov 11 '15 00:11 kcraft

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 ...

analogrelay avatar Nov 11 '15 01:11 analogrelay

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.

kcraft avatar Nov 11 '15 05:11 kcraft