C# AssemblyFileVersion usage within a program

Use ProductMajorPart/ProductMinorPart instead of FileMajorPart/FileMinorPart : public static string Version { get { Assembly asm = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location); return String.Format(“{0}.{1}”, fvi.ProductMajorPart, fvi.ProductMinorPart); } }

What is the ThemeInfo attribute for?

ThemeInfo attribute specifies where the automatic theming mechanism should look for the theme dictionaries and the generic dictionary. Each option can be set to one of the following values: None (default): Don’t look for a resource dictionary. SourceAssembly: The dictionary is the current assembly. ExternalAssembly: The dictionary is in a different assembly, which must be … Read more

The specified version string does not conform to the required format – major[.minor[.build[.revision]]]

The maximum value for either of the parts is 65534, as you read here. This is a limit imposed by the operating system, so not even specific to .NET. Windows puts the version numbers into two integers, which together form four unsigned shorts. Adding some metadata to it (for the * option I guess) makes … Read more

Visual Studio 2017 and the new .csproj InternalsVisibleTo

Just in case anyone would like to put InternalsVisibleTo within a .csproj file instead of AssemblyInfo.cs (a possible scenario is to have a naming convention between a project under test and a test project), you can do it like this: <ItemGroup> <AssemblyAttribute Include=”System.Runtime.CompilerServices.InternalsVisibleTo”> <_Parameter1>$(MSBuildProjectName).Test</_Parameter1> </AssemblyAttribute> </ItemGroup> Having this the following code will be generated [assembly: … Read more

What are the best practices for using Assembly Attributes?

We’re using a global file called GlobalAssemblyInfo.cs and a local one called AssemblyInfo.cs. The global file contains the following attributes: [assembly: AssemblyProduct(“Your Product Name”)] [assembly: AssemblyCompany(“Your Company”)] [assembly: AssemblyCopyright(“Copyright © 2008 …”)] [assembly: AssemblyTrademark(“Your Trademark – if applicable”)] #if DEBUG [assembly: AssemblyConfiguration(“Debug”)] #else [assembly: AssemblyConfiguration(“Release”)] #endif [assembly: AssemblyVersion(“This is set by build process”)] [assembly: AssemblyFileVersion(“This … Read more

Equivalent to AssemblyInfo in dotnet core/csproj

As you’ve already noticed, you can control most of these settings in .csproj. If you’d rather keep these in AssemblyInfo.cs, you can turn off auto-generated assembly attributes. <PropertyGroup> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> </PropertyGroup> If you want to see what’s going on under the hood, checkout Microsoft.NET.GenerateAssemblyInfo.targets inside of Microsoft.NET.Sdk.

Can I automatically increment the file build version when using Visual Studio?

In visual Studio 2008, the following works. Find the AssemblyInfo.cs file and find these 2 lines: [assembly: AssemblyVersion(“1.0.0.0”)] [assembly: AssemblyFileVersion(“1.0.0.0”)] You could try changing this to: [assembly: AssemblyVersion(“1.0.*”)] [assembly: AssemblyFileVersion(“1.0.*”)] But this won’t give you the desired result, you will end up with a Product Version of 1.0.* and a File Version of 1.0.0.0. Not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)