Switch to Package References
The abpvdev references to-package command converts local project references back to package references. This is useful when you want to switch from development mode (using local sources) back to using NuGet packages.
Usage
abpvdev references to-package [workingdirectory] [options]
Parameters
| Parameter | Description |
|---|---|
workingdirectory |
Working directory. Default: . |
Options
| Option | Shortcut | Description |
|---|---|---|
--sources |
-s |
Sources to switch to packages (default: all sources) |
--help |
-h |
Shows help text |
Examples
Switch All to Packages
abpvdev references to-package
Converts all local project references back to package references.
Switch Specific Sources
abpvdev references to-package --sources abp
Only switches packages matching the "abp" source configuration back to NuGet packages.
Switch Multiple Sources
abpvdev references to-package --sources abp custom-libs
Switch in Specific Directory
abpvdev references to-package C:\Path\To\Projects
How It Works
The command performs these steps:
- Find Projects: Finds all
.csprojfiles in the working directory - Identify Local References: Identifies project references pointing to configured local sources
- Retrieve Versions: Gets the backed-up version from PropertyGroup (stored during
to-local) - Convert References: Replaces project references with package references
Example Diff (With Backup)
When the version was backed up during to-local, the conversion is automatic:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<abpVersion>8.0.0</abpVersion>
</PropertyGroup>
<ItemGroup>
- <ProjectReference Include="..\..\abp\framework\src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
- <ProjectReference Include="..\..\abp\framework\src\Volo.Abp.Ddd.Application\Volo.Abp.Ddd.Application.csproj" />
+ <PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="8.0.0" />
+ <PackageReference Include="Volo.Abp.Ddd.Application" Version="8.0.0" />
</ItemGroup>
</Project>
Example Diff (Without Backup)
If you manually added project references (without using to-local), you'll be prompted for versions:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
- <ProjectReference Include="..\..\abp\framework\src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
+ <PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="8.0.0" />
</ItemGroup>
</Project>
You'll be prompted to enter the version (per source, not per package):
Enter version for source 'abp': _
Before → After Comparison
| State | Reference Type | Example |
|---|---|---|
| Before | Project Reference | <ProjectReference Include="..\..\abp\framework\src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" /> |
| After | Package Reference | <PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="8.0.0" /> |
Workflow
Typical workflow for working with local sources:
- Start with packages: Use NuGet packages in your project
- Switch to local:
abpvdev references to-local- for development - Work on code: Make changes in your local source
- Switch back:
abpvdev references to-package- when done
Use Cases
Done with Development
After debugging or adding features to a local fork:
abpvdev references to-package
Switching Branches
When switching between branches that expect different versions:
abpvdev references to-package --sources abp
CI/CD
Ensure package references are used in CI pipelines:
abpvdev references to-package
dotnet build
Troubleshooting
Version Not Found
If the backed-up version is missing, you'll be prompted to enter it manually. You can find the version in:
- NuGet.org
- Your local NuGet cache
- The project's csproj file
Multiple Matches
If multiple package versions match, specify the exact version when prompted.
Important Notes
- Version backup is per source: The
to-localcommand stores the version as{SourceKey}Version(e.g.,abpVersion), not per package - All packages in a source share the same version: When switching back, all packages from the same source use the backed-up version
- Order matters: Run
to-packagebefore runningto-localagain to avoid conflicts
Next Steps
- Configure Local Sources - Set up your sources
- Switch to Local References - Convert packages to local projects