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 <AllowUnsafeBlocks /element in
the csproj file?
Thanks
Andy 5 6074
"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 <AllowUnsafeBlocks /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
AllowUnsafeBlocks=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 /:AllowUnsafeBlocks=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.comwrote:
It should and it does for me. *What kind of error do you get? *If youadd
AllowUnsafeBlocks=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 /:AllowUnsafeBlocks=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.comwrote:
It should and it does for me. What kind of error do you get? If you add
AllowUnsafeBlocks=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 <AllowUnsafeBlock/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.comwrote:
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 <AllowUnsafeBlock/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.comwrote:
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 <AllowUnsafeBlock/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?...
|
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...
|
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...
|
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++...
|
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...
|
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...
|
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...
|
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.
...
|
by: wizofaus |
last post by:
Given the following code:
public class Test
{
static unsafe void StringManip(string data)
{
fixed (char* ps = data)
ps = '$';
}
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
| |