-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NuGet pack Unable to cast object of type 'System.String' to type 'NuGet.Frameworks.NuGetFramework' #4808
Comments
There is an issue tracking this here: #4491 nuget.exe doesn't support NETCore SDK projects currently, and the error message you get is confusing as you can see. |
The workaround is to use |
Got it, thanks Justin! |
Hi, I'm creating a .net standard library. I'm running
This is the content of MyProject.csproj:
What I'm doing wrong? |
@victorv977 that is an msbuild error and not related to Pack. You should see the same result with |
@emgarten I ran |
I also had the same problem using nuget pack from TeamCity (nuget 4.1). [Step 5/5] pack: Create NuGet package from src\Loqu8.Azure.Mobile.Client.SQLiteStore\Loqu8.Azure.Mobile.Client.SQLiteStore.csproj (2s) |
@v1ct0rv I think your issue is related to a spelling error in: /t:pack MyProyect.csproj |
Same issue using 4.6.2 NuGet.exe ... It it caused big pain.
|
Same issue as @Drasius2, which makes this a pain as we're migrating part of our projects over.
|
In our case, the issue was solved by updating NuGet: |
@praveena-m your solution worked for me too! |
@praveena-m's solution worked for me also. Time to update the NuGet task to allow for choosing version 4. |
* chore(ci): create multiple jobs * chore(ci): further split the jobs * chore(ci): correct invalid job name * chore(ci): default to windows host * chore(ci): use matrix strategy * chore(ci): restore before building for cleanup code A reference was not found during build for cleanup code. Perhaps a restore first will solve the problem. * chore(ci): create build directory * chore(ci): add the pipeline under build * chore(ci): set up a nuget package * chore(ci): add metadata for nuget And remove the JetBrains reference which isn't needed. * chore(ci): don't specify an output directory * chore(ci): don't try to publish everything * chore(ci): nuget doesn't support NETCore SDK projects NuGet/Home#4808 * chore(ci): pack each build configuration * chore(ci): only pack for release * use variables collection instead of $ reference * chore(ci): push to nuget
If using Azure Pipelines with YAML, add this task in the beginning: steps:
- task: NuGetToolInstaller@0
inputs:
versionSpec: '4.9.1' |
I'm on a mac if that matters (it's a local build agent). |
Adding on a bit of info just because Google brought me here. Azure DevOps encounters this error because by default, it uses the cached version of NuGet.exe that's available on its build agent. At the time of this writing, that was 4.3.0 for me. @JeffreyCA 's solution works, but that line will force your build to always use version 4.9.1 of NuGet. I prefer to use the latest version available in case there are other bug fixes I want, so I modified the YAML slightly to always check for the latest version. My step looks like this: - task: NuGetToolInstaller@1
inputs:
checkLatest: true |
Getting an error with NuGet 4.0 pack command (nuget.exe):
Unfortunately can not provide a repro project. The project is a netstandard1.0 one.
The text was updated successfully, but these errors were encountered: