Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Cannot build VB.Net projects. Get error vbc, NCRUNCH; ^^ ^^ ' is not valid: Character is not valid.
mg_steele
#1 Posted : Monday, February 6, 2012 12:29:44 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/4/2012(UTC)
Posts: 4
Location: UK

Was thanked: 1 time(s) in 1 post(s)
The latest version of Ncrunch 1.37.0. 46.b fails to build my VB.Net projects. They ran ok in the last version.

The error I am getting is

vbc (0): Project-level conditional compilation constant 'VBC_VER = 9.0,TARGET = "library",CONFIG="Debug",DEBUG=-1,TRACE=-1,_MyType="Windows",PLATFORM="AnyCPU",NCRUNCH; ^^ ^^ ' is not valid: Character is not valid.


When I remove any <DefineConstants> tags from within the text of my vbproj files then NCrunch builds ok.
Remco
#2 Posted : Monday, February 6, 2012 9:00:54 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,620

Thanks: 732 times
Was thanked: 931 time(s) in 887 post(s)
Ouch - is there any chance I could get a copy of that DefineConstants tag?
erikbra
#3 Posted : Tuesday, February 7, 2012 6:49:21 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2012(UTC)
Posts: 3
Location: Bergen

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Same issue here - with an empty <DefineConstants> tag:

<DefineConstants>
</DefineConstants>

works fine if I comment it out in the .vbproj file...

(same version of NCrunch as the OP)
Remco
#4 Posted : Tuesday, February 7, 2012 7:00:54 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,620

Thanks: 732 times
Was thanked: 931 time(s) in 887 post(s)
Would either of you guys be able to show me the DefineConstants tag after it's been corrupted by NCrunch? You can find this by doing the following:

- Let the build fail with the error
- Right click the failed project in the Tests Window, go to Advanced and choose 'Browse to workspace'
- Look for the .proj file in the workspace
- Copy/paste the warped DefineConstants declaration
erikbra
#5 Posted : Tuesday, February 7, 2012 7:55:36 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2012(UTC)
Posts: 3
Location: Bergen

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
It looks like this after NCRUNCH has been added:

<DefineConstants>NCRUNCH;
</DefineConstants>
Remco
#6 Posted : Tuesday, February 7, 2012 7:59:11 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,620

Thanks: 732 times
Was thanked: 931 time(s) in 887 post(s)
Thanks for the prompt response. A workaround to the problem would be to make sure the opening and closing tags are both on the same line in the source .proj file. I'll make sure a fix is included in the next release for this.


Cheers,

Remco
1 user thanked Remco for this useful post.
erikbra on 2/7/2012(UTC)
erikbra
#7 Posted : Tuesday, February 7, 2012 8:16:16 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2012(UTC)
Posts: 3
Location: Bergen

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Thank you. I'll use the workaround for now, and thanks for the quick response to you as well... Keep up the good work. I'm just starting to use NCrunch, and it looks very promising...
1 user thanked erikbra for this useful post.
Remco on 2/7/2012(UTC)
mg_steele
#8 Posted : Tuesday, February 7, 2012 5:39:37 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/4/2012(UTC)
Posts: 4
Location: UK

Was thanked: 1 time(s) in 1 post(s)
Hi there, Thank you for the quick response. NCrunch is something I've been recommending for while now and its gone down very well with people I work with.

Unfortunately, the workaround did not work. With this version we still need to remove the tags from VBPROJ files completely for it to build, even if they are not empty. Putting them on one line still gives the error.

So for empty tags on a single line, the generated, corrupted file looks like:

<DefineConstants>NCRUNCH;
</DefineConstants>

For non-empty e.g. one with Win32 defined, I get:

<DefineConstants>NCRUNCH;Win32=True</DefineConstants>

Which also fails with the same error.

Hope this helps.
Remco
#9 Posted : Tuesday, February 7, 2012 8:29:03 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,620

Thanks: 732 times
Was thanked: 931 time(s) in 887 post(s)
What happens if you try the following?

<DefineConstants>DEBUG</DefineConstants>
mg_steele
#10 Posted : Wednesday, February 8, 2012 9:23:53 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/4/2012(UTC)
Posts: 4
Location: UK

Was thanked: 1 time(s) in 1 post(s)
I get the following error

vbc (0): Project-level conditional compilation constant 'VBC_VER = 9.0,TARGET = "library",CONFIG="Debug",DEBUG=-1,TRACE=-1,_MyType="Windows",PLATFORM="AnyCPU",NCRUNCH; ^^ ^^ DEBUG' is not valid: Character is not valid.
Remco
#11 Posted : Wednesday, February 8, 2012 10:45:58 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,620

Thanks: 732 times
Was thanked: 931 time(s) in 887 post(s)
Taking a look at the build process for VB, I can see now why this is failing. It seems VB has a completely different workflow for the DefineConstants than other .NET languages. Can you give me any details regarding what you are using DefineConstants for in this project? Perhaps I can find a different workaround.
mg_steele
#12 Posted : Wednesday, February 8, 2012 4:37:10 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/4/2012(UTC)
Posts: 4
Location: UK

Was thanked: 1 time(s) in 1 post(s)
Hi Remco. Yes, it certainly looks like VB.Net problem as none of our C# projects fail. In fact I've now removed the majority of <DefineConstants> from our vbproj files as they are empty and seem to have been put in by previous version of Visual Studio - or perhaps by the VS upgrade routine.

The remaining few projects have <DefineConstants>Win32=true</DefineConstants> and do not appear to act on this particular constant, so I feel it's probably safe to remove these as well.

For any other users that do depend on custom constants from their vbproj I'm not sure how you would workaround it. Maybe it makes more sense to check other compile-time constants e.g Configuration, Platform?

Thanks again for your quick response and guidance. I'm loving the new NCrunch features like step into code, debug and line execution timings by the way!
1 user thanked mg_steele for this useful post.
Remco on 2/8/2012(UTC)
GrahamWade
#13 Posted : Wednesday, February 22, 2012 5:51:41 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/22/2012(UTC)
Posts: 2
Location: UK

Firstly love the tool.

Any project that we try and compile that uses conditional compilation tags fails.

We enter the tag in the Visual Studio Project file editor, we cannot do without the conditional compilation. Any work around identified yet.

Error Message:

NCrunch: If you are experiencing problems in getting this project to build, have a look at https://www.ncrunch.net/...ng_project-build-issues
vbc (0): Project-level conditional compilation constant 'VBC_VER = 9.0,TARGET = "library",CONFIG="Debug",DEBUG=-1,TRACE=-1,_MyType="Windows",PLATFORM="AnyCPU",NCRUNCH; ^^ ^^ _MYFORMS=True' is not valid: Character is not valid.
Remco
#14 Posted : Wednesday, February 22, 2012 8:51:19 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,620

Thanks: 732 times
Was thanked: 931 time(s) in 887 post(s)
Hi Graham,

Thanks for posting and I'm glad you like the tool :)

I've done some more digging and I've managed to find a workaround for using DefineConstants on VB.NET projects. Depending upon the number of projects in your solution, there may be some effort involved.

Basically, NCrunch is manipulating the XML in your .vbproj files to add an extra compile constant to the expression where it is present. NCrunch only looks in the .vbproj file, not in any of the project file 'imports', so we should be able to work around the bug by placing your DefineConstants declaration in and imported .targets file.

In the root of your solution, create a file with the following content:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="(- BROKEN LINK -)">
<PropertyGroup>
<DefineConstants>MyConstant="MyValue"</DefineConstants>
</PropertyGroup>
</Project>

... Adjusting the MyConstant="MyValue" as you need to. You will then need to modify each project file requiring the constant. Remove the <DefineConstants> declaration from the project file, and add an <Import> declaration pointing to the file you created above. For example:

<Import Project="..\NCrunchWorkaround.targets" />

This should allow you to use compiler constants for VB.NET without NCrunch blowing up. I'm keen to hear how well this works for you!


Cheers,

Remco
Remco
#15 Posted : Wednesday, March 7, 2012 12:15:05 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,620

Thanks: 732 times
Was thanked: 931 time(s) in 887 post(s)
For anyone interested, the above issues should now be fixed in 1.38b (just released!)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.071 seconds.