C
C#2w ago
stigzler

Where does the "Version" value come from in a dll's properties in Visual Studio?

Currently moving over to .net 8 from Framework and getting used to the VS idiosyncracies I've managed to figure how to alter the FileVersion, PackageVersion and AssemblyVersion for a dll build (what, no VersionVersion?) However, I need to be able to quickly see the version of this built dll when I use it in other projects. I import the dll and it's properties look like the attached. However, I've set it to version 1.1.0.0 in my original dll build. Where the hell are "Specific Version" and "Version" coming from and why aren't they showing as "1.1.0.0" (they do on the dll file itself - see attached) Here's what I tried in the original dlls project file:
<PropertyGroup>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<Version>1.1.0.0</Version>
<VersionPrefix>1.1.0.0</VersionPrefix>
</PropertyGroup>
<PropertyGroup>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<Version>1.1.0.0</Version>
<VersionPrefix>1.1.0.0</VersionPrefix>
</PropertyGroup>
No description
No description
29 Replies
ero
ero2w ago
What is that first screenshot coming from? Like what is it showing? Why does it matter?
stigzler
stigzlerOP2w ago
OK - so stigzler.Utilities.Base.TestUI references stigzler.Winforms.Base. The file properties screenie is for stigzler.Winforms.Base in the stigzler.Utilities.Base.TestUI\bin\Debug\net8.0-windows folder (and shows the correct Version numbers as built in the stigzler.Winforms.Base codebase). The first screenshot is the properties panel for the reference for stigzler.Winforms.Base in stigzler.Utilities.Base.TestUI. Reason it matters is because I'm doing a huge upgrade task with multi-layer dependencies, so would rather be able to check at a glance in VS what version of a dll it is using rather than having to go in and manually inspect each dll file.
ero
ero2w ago
why are you referencing dlls in the first place?
stigzler
stigzlerOP2w ago
what? Sorry - I don't understand your question - projects reference dlls, right?
ero
ero2w ago
are you using a
<Reference Include="path/to/foo.dll" />
<Reference Include="path/to/foo.dll" />
or
<ProjectReference Include="path/to/foo.csproj" />
<ProjectReference Include="path/to/foo.csproj" />
? if the former, why?
stigzler
stigzlerOP2w ago
Oh, I see. I added it via the VS UI (Dependencies>AddProjectReference>Browse and then browse to the stigzler.Winforms.Base dll) The relevant csproj seems to be (auto gen by VS):
<ItemGroup>
<Reference Include="stigzler.Winforms.Base">
<HintPath>..\..\stigzler.Winforms.Base\stigzler.Winforms.Base\bin\Debug\net8.0-windows\stigzler.Winforms.Base.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="stigzler.Winforms.Base">
<HintPath>..\..\stigzler.Winforms.Base\stigzler.Winforms.Base\bin\Debug\net8.0-windows\stigzler.Winforms.Base.dll</HintPath>
</Reference>
</ItemGroup>
No description
ero
ero2w ago
you will want to add a reference to the actual project, not the dll that is assuming the projects are in the same solution of course
stigzler
stigzlerOP2w ago
Huh? If I go through the route above, I can only browse to "Component Files" (exe or dlls etc) - there is no facility to essentially refernce an external project no - not in same solution
ero
ero2w ago
i would have to question why they're not in the same solution, but there are plenty of good reasons for that. if the projects are coupled enough, sharing the same solution might make sense. in any case, you should be perfectly able to reference projects outside of the solution, though it's a bit uncommon. what a project reference allows is for changes in one project to appear in the other projects instantly without you having to rebuild. referencing raw dlls isn't usually something i would recommend anyone do, though it is very convenient a local nuget package source is more appropriate, but more work
stigzler
stigzlerOP2w ago
because Winforms.Base is re-used across many different solutions/projects. Yeah - aware of this, but looking for solution with 'raw' referencing rather than through nuget guess it might be a job for SO
ero
ero2w ago
i still don't quite understand why checking the version of the dll matters. you only have one version present at that path at all times anyway and you should surely be aware of what version you last built
stigzler
stigzlerOP2w ago
thanks for your help - will post on SO
ero
ero2w ago
good luck :p what you want doesn't appear to be possible SpecificVersion is a bool specifying whether only one specific version of a reference should be allowed to be included Version, then, is that specific version you only allow to be referenced meaning it's not something that can be fetched from the reference, but is something you specify to ensure version safety @stigzler
stigzler
stigzlerOP2w ago
apols - was afk. But Version property does populate in Framework applications, as per attachment. ImageListView is a locally built and referenced assembly. Think I'll just put all this down to MS going increasingly backwards as ever before it goes forwards....
stigzler
stigzlerOP2w ago
No description
ero
ero2w ago
Could you show the entry for that reference in the project file?
stigzler
stigzlerOP2w ago
<Reference Include="ImageListView">
<HintPath>..\..\..\..\..\2.ThirdParty\oozcitak\OfficialForks\imagelistview\ImageListView\bin\Debug without WPF\ImageListView.dll</HintPath>
</Reference>
<Reference Include="ImageListView">
<HintPath>..\..\..\..\..\2.ThirdParty\oozcitak\OfficialForks\imagelistview\ImageListView\bin\Debug without WPF\ImageListView.dll</HintPath>
</Reference>
ero
ero2w ago
The only place I see a version number specified in that package is <ProductVersion>. I assume you cloned this to edit it locally...? If the same isn't working for SDK projects, then the reason is simply because Visual Studio never received correct support for it. I wouldn't view it as a regression I suggest reporting an issue from within VS Worth noting that this matters exclusively for VS, other editors might neither know nor care about a display like this
stigzler
stigzlerOP2w ago
Yeah - cheers ero - as I thought
ero
ero2w ago
If you can, rethink the way you reference external code. It very much feels unlike what's done normally today. Is this for enterprise code? Or is it all private stuff?
stigzler
stigzlerOP2w ago
oh no - I'm a hobby coder - just for silly retro gaming apps + plugins
ero
ero2w ago
Hmm. Well, there's not too much I can suggest beyond that. I have a feeling you've adopted a few practices that aren't standard, which may be the cause of your problems
stigzler
stigzlerOP2w ago
Without a doubt
ero
ero2w ago
I agree the inconsistency between netfw and net is a bit of an eyebrow raiser, but perhaps if you report it as a bug, someone from the VS support team can help you out Have you checked that it isn't <ProductVersion>? Or, perhaps, where is the 13.8.2.4 coming from in that reference above? As in, what property stores that identifier in the ImageListView project?
stigzler
stigzlerOP2w ago
Good idea - I'll give that a go at some point - thanks for all your help
ero
ero2w ago
In any case, consider switching to project references where possible $close
MODiX
MODiX2w ago
If you have no further questions, please use /close to mark the forum thread as answered
wasabi
wasabi2w ago
That's the file version. Its a PE level value. Set by FileVersion. Otherwise I agree with everything else people told him.
ero
ero2w ago
i'll believe it if this guy says it!

Did you find this page helpful?