Reputation: 8274
I get this error continuously on mac VS 7.4.3 when trying to run simple web form.
CSC : error CS1902: Invalid option 'portable' for /debug; must be full or pdbonly
I have tried manually updating .csproj file with:
<DebugType>portable</DebugType>
But did not help anything; I am understanding it's from package being window's / microsoft based; but have no idea how to fix to run with mac.
/Library/Frameworks/Mono.framework/Versions/5.8.1/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2057,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Entity". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
I have also commented out all instances of 'portable' in the file above.. ?
Upvotes: 5
Views: 11622
Reputation: 19
In VS 2022, do the following:
For all compiler versions starting with C# 6.0, there is no difference between pdbonly and full. Choose pdbonly. To change the location of the .pdb file, see PdbFile.
Upvotes: 1
Reputation: 71
Writing this since I havent seen an answer like mine, hoping someone would find this helpful:
Got the same error for installing Fluent.Infrastructure(version '2.0.0-beta-01') while trying to find a reference for ApplicationUser class - all sorted out after I removed it from the project and followed this solution: https://stackoverflow.com/a/34178606
Upvotes: 1
Reputation: 21
Upvotes: 0
Reputation: 3491
For anyone hitting this recently -- I just ran into this while using jetbrains rider 2020.1 / VS 2019 (I do most dev in rider, but will do certain DB tasks and some web deploy in VS).
The problem was that one of my projects (a project I newly added to the solution) for whatever reason had some property setting that was incorrect. I solved this problem in Jet Brains Rider... but I'll share how to solve it in VS 2019 as well. The solution in my case was to:
JET BRAINS RIDER 2020.1
Visual Studio 2019
If this doesn't solve your problem, re-read your error message and try to deduce which project/which configuration the problem is emanating from, and try to reconfigure the build options there.
Upvotes: 5
Reputation: 3539
I believe this has to do with compiling with an outdated compiler (aka: MSBuild.exe).
For my setup I have a build.bat file with one line:
"c:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe" "<path/to/project/file>.csproj" /t:Build /p:Configuration=Debug /p:Platform="AnyCPU"
So, MSBuild.exe is called and compiles the project based on the .csproj into an exe.
If instead of using the compiler from visual studio community I try and use this other one:
"c:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" "<path/to/project/file>.csproj" /t:Build /p:Configuration=Debug /p:Platform="AnyCPU"
Bam, I get compile error:
"Invalid option 'portable' for /debug; must be full or pdbonly"
So conclusion for me was that MSBuild/15.0 worked with the new debug options and MSBuild/14.0 did not.
Upvotes: 1