Hi,
I have a question... I have some code which has an unsafe block in it.
In VS2008 (Framework 3.5), i go to the project property and check the
box that allows unsafe blocks. The code compiles fine.
On my build server though, things are not happy. The error seems to
be that /unsafe needs to be set as a command line option, even though
MSBuild is being used.
Shouldn't MSbuild be picking up the <AllowUnsafeBlo cks /element in
the csproj file?
Thanks
Andy 5 6108
"Andy" wrote:
Hi,
I have a question... I have some code which has an unsafe block in it.
In VS2008 (Framework 3.5), i go to the project property and check the
box that allows unsafe blocks. The code compiles fine.
On my build server though, things are not happy. The error seems to
be that /unsafe needs to be set as a command line option, even though
MSBuild is being used.
Shouldn't MSbuild be picking up the <AllowUnsafeBlo cks /element in
the csproj file?
Thanks
Andy
Hi Andy,
It should and it does for me. What kind of error do you get? If you add
AllowUnsafeBloc ks=true to the command does it compile then?
--
Happy Coding!
Morten Wennevik [C# MVP]
I get an error saying /unsafe has to be specified on the command
line...
If I add /:AllowUnsafeBlo cks=true to the command line for msbuild, it
builds it. That's how I've worked around this, but because all my
builds use the same build command, they all now have that switch,
which isn't ideal to me.
On Oct 16, 2:19*am, Morten Wennevik [C# MVP]
<MortenWenne... @hotmail.comwro te:
It should and it does for me. *What kind of error do you get? *If youadd
AllowUnsafeBloc ks=true to the command does it compile then?
"Andy" wrote:
I get an error saying /unsafe has to be specified on the command
line...
If I add /:AllowUnsafeBlo cks=true to the command line for msbuild, it
builds it. That's how I've worked around this, but because all my
builds use the same build command, they all now have that switch,
which isn't ideal to me.
On Oct 16, 2:19 am, Morten Wennevik [C# MVP]
<MortenWenne... @hotmail.comwro te:
It should and it does for me. What kind of error do you get? If you add
AllowUnsafeBloc ks=true to the command does it compile then?
Hi Andy,
Do you specify which platform and configuration msbuild should use on your
build machine? I believe MSBuild defaults to AnyCPU and Debug and if your
project files don't have the <AllowUnsafeBlo ck/node set in this
configuration it will complain about any unsafe blocks.
--
Happy Coding!
Morten Wennevik [C# MVP]
Actually that raises a good point; I keep my configuration in Debug,
while my build server sets it to Release. I'll make sure to set this
for all configurations in the project file and see what happens.
On Oct 17, 12:12*pm, Morten Wennevik [C# MVP]
<MortenWenne... @hotmail.comwro te:
Do you specify which platform and configuration msbuild should use on your
build machine? I believe MSBuild defaults to AnyCPU and Debug and if your
project files don't have the <AllowUnsafeBlo ck/node set in this
configuration it will complain about any unsafe blocks.
HI,
Yes, that was it. I went to the Configuration settings and choose All
Configurations, and check Allow Unsafe code there, and it builds
correctly now.
Thanks for your help!
Andy
On Oct 17, 12:12*pm, Morten Wennevik [C# MVP]
<MortenWenne... @hotmail.comwro te:
Do you specify which platform and configuration msbuild should use on your
build machine? I believe MSBuild defaults to AnyCPU and Debug and if your
project files don't have the <AllowUnsafeBlo ck/node set in this
configuration it will complain about any unsafe blocks.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Elidel |
last post by:
Is the use of a COM object in a c# program considered 'unsafe' code ?
Does the method that calls the COM object need the 'unsafe' keyword ?
Is code that calls a COM object considered unmanaged?
Is 'unsafe' code the same as unmanaged code ?
|
by: Wayne Gibson |
last post by:
Hi,
Firstly sorry for cross posting, but I didn't know which would be the best
group to post too..
I was wondering if anybody could help me with a problem that I have.
I have created a windows user control that I want to place on a HTML file so
that it can be used on the internet. The problem is that in order to get
the performance, I've had to use some unsafe code to do it. Namely
pointers.
|
by: |
last post by:
Wel, I am rebuilding the VC# 2002 project that I have deployment problems
with the 2003 version, hoping this solves the problems, but now I encounter
this wierd bug???
If I have the project, and do not compile with "Allow Unsafe Code
Blocks=false" set to true, then the project compiles and no problems.
BUT if I compile with "Allow Unsafe Code Blocks=true" then I het the error
below. With unsafe {} of unsave{} removed it dos not solve the...
|
by: Jon Milner |
last post by:
How do I declare that my code is unsafe? Sorry the help
files at my University have not been installed!
|
by: CodeTyro |
last post by:
My native language being C++, I've got a few questions that a couple of hours
of searching on msdn didn't answer.
First, when using unsafe code and pointers, what is the C# equivalent to the
C++ "delete" command? I would like to keep my memoryspace clean, but I've
been unable to find a way to do it thus far.
Second, I'm using structs to store a specific set of data. Is there a C#
equivalent to the C++ STL "Vector" (or any of the...
| |
by: Jerome |
last post by:
Hi all,
I *have* to use unsafe code, but I have a questions : it seems I can't use
delete to free something like : int * myarray = new int.
What should I do if I wanna create/delte/resize such an array ? I'm afraid I
didn't get all about the unsafe code !
Clearly, how should I use the unsafe code to do something like that (in c++)
:
....
if(myArray != null)
|
by: rockdale |
last post by:
Hi, all
Could somebody tells me where can I set "Allow unsafe code" in visual
studio 2005. I could not find any Project Properties|Configuration
Properties in my website solution.
Mine appl is a VS 2005 Web Site Projects, should I migrate to VS 2005
Web Application Projects?
Thanks a lot
|
by: Daniel Knöpfel |
last post by:
Hi all
I need to adapt an Msbuild script to compile a visual studio 2005 solution
(including several projects and a website). The application is written in C#
and using .NET 2.0. Due to late changes the application uses unsafe code in
one project. Compiling in VS 2005 is no problem, however the build script
that we used no longer works. Unfortunately i dont not have any experience
in making build scripts using Msbuild. How does one add a...
|
by: =?Utf-8?B?U2hhcm9u?= |
last post by:
I have two piece of unsafe code. In the first one I'm getting the byte*
pointer of a Bitmap data, and the second one in inside a loop that uses that
byte* pointer to set the data in the Bitmap.
The trouble is that that each of this pieces of code are bound by a
different unsafe section, therefore I'm getting an error that the second
unsafe section does not "The name 'refBuf' does not exist in the current
context"
...
|
by: wizofaus |
last post by:
Given the following code:
public class Test
{
static unsafe void StringManip(string data)
{
fixed (char* ps = data)
ps = '$';
}
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |