#Define symbol during web publish

432 Views Asked by At

I have an ASP.NET web application project that references other C# projects. One of those C# projects has a compiler directive that reports an error if a certain symbol is not defined:

#if (!FOO || !BAR)

   #error "Define symbol for either FOO or BAR"

#endif

When I publish the site, it doesn't define the symbol and, thus, a compiler error results. Is there a way to define a symbol for a referenced project during Visual Studio's publishing process?

1

There are 1 best solutions below

0
On BEST ANSWER

One work around is to enable the "Precompile during Publishing" option.

Screenshot for Visual Studio Publish Web Wizard