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 6110
"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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |