Lieutenant Dan
Lieutenant Dan

Reputation: 8274

'CSC : error CS1902: Invalid option 'portable' for /debug; must be full or pdbonly'

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

Answers (5)

gabegi
gabegi

Reputation: 19

In VS 2022, do the following:

  1. Right click on your project
  2. Go to Properties
  3. In Build > General > Debug symbols
  4. There you have four options > select PDB file, current platform

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.

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation#debugtype

ScreenshotInVisualStudio

Upvotes: 1

Savyon
Savyon

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

A. Salano
A. Salano

Reputation: 21

  1. select the project
  2. right click
  3. go to properties
  4. select Build and click Advanced
  5. Debugging information - Select "Full" enter image description here

Upvotes: 0

PaulG
PaulG

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

  1. Right-click the project directory in Rider. Select 'Properties' down at the bottom.
  2. In the left pane, under 'configuration' select the Debug Configuration (I have mine currently set to Debug|AnyCPU).
  3. About halfway down there is a section called Debug. You'll probably want to have the Debug Symbols checkbox checked, and then in the drop-down, you can select the appropriate Debug Type (probably Full, unless you need something different). enter image description here

Visual Studio 2019

  1. Right-click the project folder and select properties (down at the bottom). The Properties interface should open in that classic windows beige color. On the left will be a panel of options [Application, Build, Build Events, etc...]
  2. Select build from the panel on the left.
  3. At the very top of the configuration window, you should see two drop-downs: Configuration and Platform. You need to select the configuration dropw-down, and choose 'Debug'.
  4. Next, down at the bottom, there is a button "Advanced". Select this to open the advanced build settings dialog.
  5. Under the 'Output' section, there is a line that says 'Debugging information'. Change this from portable to Full (or whatever else you need). enter image description here

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

ooXei1sh
ooXei1sh

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

Related Questions