How to???

Topics: For MSBee Users
Aug 16, 2006 at 9:57 PM
migrated from power toy forums
originally posted by bracki
------------------------------------------------------

I am new using VS. I need to target framework 1.1 project that is made with VS2005(Framework 2.0). I found this software, and I download it and install.

What next? I have read doc file,but I do not understand.
can someone put here a step-by-step what I have to do.
Aug 16, 2006 at 9:57 PM
originally posted by mattdk
------------------------------------------------------

I've problems getting started too. Someone know of a more thorough guide?

UPDATE: I just realized that you can't compile using VS :-P
Aug 16, 2006 at 9:57 PM
originally posted by Jazzy
------------------------------------------------------

This is complicated in that the solution is being targeted toward users who are migrating projects from Visual Studio 2003 to Visual Studio 2005, but the compiled application needs to be run on .NET 1.1.

Having said that, I am working on some templates that incorporate some changes that allow you to create applications that target .NET 1.1 from the outset (Visual Studio 2005 template creation is pretty simple), but I have not finished my work just yet.

In working on this, I have found a few issues. Firstly the IDE knows about .NET 2.0 controls and their attributes. So I recomend compiling often after adding a few controls. The reason for this is that it allows you to find and fix the attributes that are not in the .NET 1.1 framework that the IDE adds. Next I would recomend using preprocessor instructions in order to isolate code if you need to target both frameworks.

Having said that, I have created a couple of simple applications that worked properly. One was a console application that was based on the empty propject template I created and the other was a WIndows Form project that was based on another template.
Aug 16, 2006 at 9:57 PM
originally posted by Craig Lichtenstein - MSFT
------------------------------------------------------

Let me provide an example to clarify how to use MSBee.

Let's say you have a VS 2003 Sample.sln, which contains Sample.csproj. In order to use MSBee, you would first migrate this solution to VS 2005 by opening the solution in VS 2005. This enables the project files in the solution to use MSBuild.

Assuming MSBee is installed, your next step is to point MSBuild to the MSBee files. As explained in section 4.2 of the ReadMe, you'll open Sample.csproj (perhaps in notepad) and find

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

near the bottom of the file. Directly beneath this line, you need to add:

<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX11.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX11)'=='true'" />

This statement imports CSharp related MSBuild tasks from the MSBee targets file.

The final step is to build the project. As described in section 4.3 of the ReadMe, you would run msbuild Sample.sln /t:Rebuild /p:TargetFX11=true on a command line. Setting the TargetFX11 property to true is what triggers the .NET 1.1 build.
Aug 16, 2006 at 9:58 PM
originally posted by bracki
------------------------------------------------------

OK. This work nice when I have VS2003 solution file and then I migrate it to VS2005.
It's build.
But when I try this steps with solution files that is not migrated from VS2003, when it's created with VS2005 then I get so many warnings and errors. Why? How to target framework 1.1 with solution created with VS2005?
Aug 16, 2006 at 9:58 PM
originally posted by Jazzy
------------------------------------------------------

The shore answer is that you can't. That is not the goal of the project.

The longer answer is what I was talking about before. On this list we had a short discussion on this and the result is that you have to make your own templates that have the proper modifications in place. Currently the templates I am working on target the 1.1 framework only.

An example is located on my web server. It is an empty project that you can add whatever you want and it will target the 1.1 runtime. The only problem like I mentioned is that Visual Studio 2005 will still try to use some attributes of the 2.0 framework (like declaring generics in the using statement). So you have to keep this in mind when you are creating your UI. If you are doing console applications, then it would be as simple as adding a class file for the start and doing all your coding from there.

http://www.jazzynupe.net/Business/EmptyProject-1.1.zip

I have a sample that is for Windows Forms, but it is not 100% complete I think. Also I have a few item templates that I will be working on too. They will be free of some 2.0 specific items that get included when adding files through the IDE.

But this a starter. Place this in your template folder (typically "%userprofile%\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual C#") and it should appear in your IDE as an "Empty Project (1.1)"

To try the WIndows Forms Version: http://www.jazzynupe.net/Business/WindowsApplication-1.1.zip

I plan on doing all versions in the near future.

Richard Norman
Web/Application Developer
http://jazzynupe.net/blog/
Jan 10, 2007 at 5:54 PM
MSBEE didn't compile my project against the 1.1 framework, the 2.0 framework was used instead. Section 5.1 of the word documentation for MSBEE says that the generated build log will indicate what compiler was used for building the project. Mine says that v2.0.50727 was used.

When executing the command

msbuild MyProject.csproj /t:Rebuild /p:TargetFX1_1=true

I got the following results:

Target CoreCompile:
C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /unsafe- /chec
ked- /nowarn:1701,1702 /errorreport:prompt /warn:4 /baseaddress:285212672 /defin
e:DEBUG;TRACE

Any reason why v2.0.50727 is begin used instead of v1.1.4322? How can I fix this?

Thanks,
Jan 10, 2007 at 6:39 PM
Did you modify your project file to include MSBee target files? Also make sure the ordering of target imports are correct as well.

Thanks,
Bertan
Jan 11, 2007 at 3:11 PM
Yes I did. I think it may have something to do with the references in my project. I created an empty project in VS2005 and added the MSBEE statements to the appropriate areas. When compiling this I got the expected results; it used v1.1 framework (although the build failed because the project was created in VS2005 and not migrated from previous versions - this is discussed above in previous posts).

My real project, say project A, references two other projects, say project B and project C. All projects include the MSBEE target file in their csproj files. The expected results is that projects A, B, and C will get built against the 1.1 framework. This is not the case. All projects were built against the 2.0 framework.

Target CoreCompile:
C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /unsafe- / ...

More Info on ProjectA:

In each csproj file I have the following text inserted right after the original <Import ..> element:

<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX11.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX11)'=='true'" />

In a cmd prompt I am running the following command:

msbuild ProjectA.csproj /t:Rebuild /p:TargetFX1_1=true

Please advise,

Thank you.
Jan 12, 2007 at 3:02 PM
Ok I fixed my problem. If you are having a similar problem the solution is to RESTART YOUR COMPUTER!

After restarting MSBEE was giving me the real error, which was

"File C:\Program Files\MSBuild\MSBee\MSBuildExtras.FX11.CSharp.targets could not be found"

Turns out saraford's post above had some missing text. So if you're doing a copy past from that post make sure to replace

<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX11.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX11)'=='true'" />

with

<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX11)'=='true'" />

(note that FX11 should be FX1_1).

Everything works as expected now.

Jun 26, 2007 at 10:16 PM
Or remove the conditions and make the project .NET 1.1 only. Either way it will work. :-)