Question: This question is specific to **MSBuild 15.1+ (Visual Studio 2017)** and to **PackageReference**, which is the new way `Nuget` is fully integrated within `MSBuild`. 

In my continuous integration script, I've got something like: 

```
MSBuild.exe /t:Restore MySolution.sln /p:RestoreConfigFile=NuGet.config

```

One of the `csproj` file contains: 

```
<PackageReference Include="MyPackageA">
    <Version>1.2.*</Version>
</PackageReference>

```

`MyPackageA` is an internal package and I would like nuget to resolve the reference to the latest version available, including pre-release version. 

Let's take 2 examples: 

**Example #1** 

Packages available are: 

* MyPackageA version 1.2.7-dev1
* MyPackageA version 1.2.7-dev2
* MyPackageA version 1.2.7-dev3
* MyPackageA version 1.2.8

I would like nuget to resolve the dependency and pick up MyPackageA version 1.2.8. 

**Example #2** 

Packages available are: 

* MyPackageA version 1.2.7-dev1
* MyPackageA version 1.2.7-dev2
* MyPackageA version 1.2.7-dev3
* MyPackageA version 1.2.8
* MyPackageA version 1.2.9-dev1
* MyPackageA version 1.2.9-dev2

I would like nuget to resolve the dependency and pick up MyPackageA version 1.2.9-dev2. 

However, it would only resolve to version 1.2.8 (the stable release) in both examples. 

Is there a way to tell `MSBuild` or `Nuget` to include pre-release packages?

Answer: 
At the moment, prerelease versions cannot be used together with floating versions.

You can use

```
<PackageReference Include="mypk" Version="1.0.*" />

```

OR

```
<PackageReference Include="mypk" Version="1.0.1-*" />

```

But not `1.0.*-*`.

See [this GitHub issue](https://github.com/NuGet/Home/issues/912) where this feature request is tracked.
The NuGet,version >5.6, floating version syntax allows for some pretty powerful version ranges, but it is likely that your scenario will be mostly satisfied by the following 3 floating versions:

```
<!-- Float everything! Latest version available including prerelease-->
<PackageReference Include="mypk" Version="*-*" />

<!-- Prefer latest 1.X version, include prerelease and stable -->
<PackageReference Include="mypk" Version="1.*-*" />

<!-- Prefer latest 1.0.X version, include prerelease and stable -->
<PackageReference Include="mypk" Version="1.0.*-*" />

```

[Ref](https://github.com/NuGet/Home/wiki/Support-pre-release-packages-with-floating-versions#common-scenarios)