I have a VC++ project and I need to add a reference to a managed dll. This dll has a version number which changes every build. When I add it to my project, its version is saved and if I replace it with another one (with a different version number) the project cannot compile because it doesn't find the dll with the version previously saved.
Is there a way to add a reference without a specific version?
Thank you for your help
views:
31answers:
2The C# IDE has the "Specific Version" property for a reference but the C++/CLI build system doesn't support that. There is a workaround, you can use the #using directive in source code to load an assembly reference. This by design cannot check the assembly version of the reference assembly. Normally that's a problem but not in your case. The MSDN page is here.
Note: I don't know whether this works with C++ projects -- we have C# code that references C++, but we haven't done the other way around. But just in case it's easy, I'll offer this:
With C#-to-C# references, normally you would make sure both projects are in the same solution, and then add a reference using the "Projects" tab of the Add Reference dialog (not the "Browse" tab). This way, the build system has a reference to the project in the solution (which knows its own current version number), rather than having a reference to the filename+version; and then it can cope with version number changes just fine.