question

Danbayley-0071 avatar image
0 Votes"
Danbayley-0071 asked PengGe-MSFT commented

Could not find file or assembly (VS looking for wrong version)

I recently updated a .net standardard 2.0 class library.
In doing so I moved from 1.0.3.0 to 1.0.5.0

I have 2 projects referencing this. Framework 4.7 web app and .Net core 3.1 HTTP Function

I can see the references and the DLLs are all the correct versions in the relevant folders, but when I run either of the solutions I get an error that it can't find the DLL but refers to 1.0.3.0.

I have tried:

  • deleting obj folder

  • clearing out .net temp files

  • debug / release folders

  • cleaning and rebuilding.

  • Even creating a new project recompiling and pointing to the new project instead.

It references the project rather than the DLL so there is no specific version of pubkey specified.
I've trawled files looking for a reference to 1.0.3.0 and cannot find one.

It makes me think there is an issue with the library itself but as it outputs 1.0.5.0 in to the debug/build folders I'm struggling to see why.

I've lost hours to this on forums going through the above to no avail. Any pointers would be much appreciated.

120528-visualstudio.jpg


vs-generalvs-debuggingvs-msbuild
visualstudio.jpg (78.5 KiB)
· 9
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

II just tried publishing to a local folder with IIS and the project works.
IIf I Run from VS with IIS or IIS Express I get the could not load assembly issue.
Something is wrong with the VS side I think.

1 Vote 1 ·

Hey @Danbayley-0071, I loathe problems like this because you have to line up .NET Standard with .NETFX. Some APIs are compatible, others not so much. I'll try to dig and see what I can discover.

0 Votes 0 ·

I had to re-architect some of the xml.core library to make work with functions.
as part of that I was messing about with configuration because I was struggling to get it to work in a unified way.

The issue I had was that between local, Azure app and Azure functions I was struggling to find a single consistent way to get the connnectionstrings. I thought I had it cracked. This certainly runs on my local IIS without issue. It's IIS express that is the issue.


If I publish to local IIS and attach VS I can debug. But I can;t run local IIS directly with the project.

So there is some compatibility issue within the VS project when run directly that doesn't exist after build published (I think).

0 Votes 0 ·
Show more comments

Hi, @Danbayley-0071
Thank you for your feedback. This issue has been escalated for further investigation.

1 Vote 1 ·

Thanks. I think it is an issue in the debug build template but that is way outside my knowledge.
I say this because it doesn't happen with other projects in the same solution or when I use a release build.

0 Votes 0 ·

Hi, @Danbayley-0071
I suggest you can start a new thread and report this issue to VS Product Team in our Developer Community with some reproduced or detailed information. if you do report this issue, please share the link here, other forum members who are interested or meet the same or similar issue can go to vote for this thread.


1 Vote 1 ·

Further investigation shows that if I manually copy the DLL to the temporary .Net files it works.

Given that the file is being built and I can manually copy it or publish it, it suggests that there is something wrong with the debugging / build process and copying the file to IIS / IIS Express.

Copy local is set to true.

0 Votes 0 ·

1 Answer

Danbayley-0071 avatar image
0 Votes"
Danbayley-0071 answered Danbayley-0071 commented

No progress made .... I incremented the version but despite publishing them I see no change.
The DLLs in the publish folder are correct.

120907-error.jpg


120965-version.jpg



error.jpg (435.7 KiB)
version.jpg (108.1 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 step forward .....
So the problem is the bin folder.

I don't know why but in desperation I started to copy files from the /bin/debug to the /bin folder and hey presto.

It seems the debug and release folders are updating but the main bin folder isn't.
I don't understand the mechanics of how IIS Express / VS uses /Bin but I can do some research on that.

As to where it was finding the stale dll I have no idea as it wasn't in the Bin folder. perhaps it cached a pointer / reference somewhere.

0 Votes 0 ·