"Embed Interop Types" property is missing within Reference Assembly/DLL Property Window of Visual Studio 2010 - visual-studio-2010

At work, our C# application was developed in a development computer with the following( and our application builds and runs correctly in the development environment):
-.NET Framework 4
-Visual Studio 2010
-ASP.NET Web Forms
At work, we have the following standalone build server that has
-Windows Server 2012
-Jenkins with MS Build
-For .NET Framework 4, the MS Build version is: C:\Windows\Microsoft.NET\Framework\v4.0.30319>MSBuild.exe -version Microsoft (R) Build Engine version 4.7.2558.0 [Microsoft .NET Framework, version 4.0.30319.42000] Copyright (C) Microsoft Corporation. All rights reserved.
Our standalone back-end SQL Server for the application is:
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)
When we build the application solution on the Jenkins Build server:
.cs(84,13): error CS1752: Interop type ' ' cannot be embedded. Use the
applicable interface instead. [ .csproj] .cs(84,38): error CS1752:
Interop type ' ' cannot be embedded. Use the applicable interface
instead. [ .csproj] .cs(84,34): error CS0143: The type ' ' has no
constructors defined [ .csproj] .cs(85,18): error CS1061: ' ' does
not contain a definition for 'Set' and no extension method 'Set'
accepting a first argument of type 'ActiveDs.PathnameClass' could be
found (are you missing a using directive or an assembly reference?) [
csproj] .cs(88,17): error CS1752: Interop type ' ' cannot be
embedded. Use the applicable interface instead. [ csproj]
Therefore, in order to stop the aforementioned error, we wanted to set the "Embed Interop Types" property to false.
Therefore, I opened up the application solution in question in Visual Studio 2010, but if you look at the picture file below, there is No "Embed Interop Types" property for the assembly in question:
However, as you can see from the picture, the "Embed Interop Types" property is missing. Therefore, how do I go about setting the "Embed Interop Types" property to false?

Related

How to use MSBuild to build an existing .NET 4 project for .NET 5?

Is it possible to msbuild a project that was created for .NET 4.x against the .NET 5 SDK without upgrading the project in VS?
I have a .NET 4.7 library project that I compile for .NET 4.x using msbuild (and this issue is easily reproducible by creating a "Class Library (.NET Framework)" project for .NET 4.7).
I want to build it for .NET 5, so I tried
dotnet msbuild /property:TargetFrameworkVersion=net5.0 /property:TargetFrameworkIdentifier=.NETCoreApp
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files\dotnet\sdk\5.0.100\Roslyn\Microsoft.CSharp.Core.targets(8,31): error MSB4086: A numeric comparison was attempted on "$(_TargetFrameworkVersionWithoutV)" that evaluates to "" instead of a number, in condition "('$(TargetFrameworkIdentifier)' != '.NETCoreApp' OR '$(_TargetFrameworkVersionWithoutV)' < '3.0') AND [H:\ClassLibrary1\ClassLibrary1.csproj]
C:\Program Files\dotnet\sdk\5.0.100\Roslyn\Microsoft.CSharp.Core.targets(8,31): error MSB4086: ('$(TargetFrameworkIdentifier)' != '.NETStandard' OR '$(_TargetFrameworkVersionWithoutV)' < '2.1')". [H:\ClassLibrary1\ClassLibrary1.csproj]
That seems to want $(_TargetFrameworkVersionWithoutV) so I tried
dotnet msbuild /property:TargetFrameworkVersion=net5.0 /property:TargetFrameworkIdentifier=.NETCoreApp /property:_TargetFrameworkVersionWithoutV=5.0
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files\dotnet\sdk\5.0.100\Microsoft.Common.CurrentVersion.targets(84,5): error MSB4184: The expression "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries(.NETCoreApp, net5.0, '', '', '', '')" cannot be evaluated. Input string was not in a correct format. [H:\ClassLibrary1\ClassLibrary1.csproj]
PS: I did also try comparing a pure .NET 5 library project against a .NET 4 one and based on that tried this
dotnet msbuild /property:TargetFramework=net5.0 /property:TargetFrameworkIdentifier=.NETCoreApp /property:_TargetFrameworkVersionWithoutV=5.0 /property:TargetFrameworkVersion=5.0
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files\dotnet\sdk\5.0.100\Microsoft.Common.CurrentVersion.targets(1180,5): error MSB3644: The reference assemblies for .NETCoreApp,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [H:\ClassLibrary1\ClassLibrary1.csproj]
NET 5 is the new release version of Net Core rather than Net Framework.
See this document:
And NET 5 is for new-sdk style project while net framework 4.7 project in your side is non-sdk style project.
So you can not use a new-sdk style project's property for a non-sdk style project. See this document.
Also, new-sdk style projects use TargetFramework while non-sdk style project uses TargetFrameworkVersion. And .NET 5 should be used with TargetFramework but your non-sdk project does not identify it.
Solution
So you should change your net framework project from non-sdk into new-sdk.
You could create a new net core project and then change its xxx.csproj file into:
<TargetFramework>net47</TargetFramework>
And then migrate your old project's content into the new one which means that this project is a new-sdk style project with net framework.
See Overview of porting from .NET Framework to .NET Core and also this document.
Then, you can use
dotnet msbuild /property:TargetFramework=net5.0

How to remove the /aspnet parameter from FxCopCmd (error CA0001)

I'm trying to use FxCop on SonarQube 4.5.1, but the FxCopCmd is failing.
The problem is, when SonarQube creates the FxCopCmd call, he adds the parameter /aspnet. Since my program is a Web Project and not a Web Site, this parameter is causing 4 analysis engire exceptions:
C:\Program Files\Microsoft Fxcop 10.0>FxCopCmd.exe /file:G:\sbs1\workspace\Projeto2\DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ruleset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /forceoutput /searchgac /aspnet
Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86
Copyright (C) Microsoft Corporation, All Rights Reserved.
Loaded designrules.dll...
Loaded globalizationrules.dll...
Loaded interoperabilityrules.dll...
Loaded mobilityrules.dll...
Loaded namingrules.dll...
Loaded performancerules.dll...
Loaded portabilityrules.dll...
Loaded securityrules.dll...
Loaded securitytransparencyrules.dll...
Loaded usagerules.dll...
Loaded DCX.ITLC.Web.dll...
Initializing Introspection engine...
An unhandled exception was encountered during GlobalBeforeAnalysis:
...
Analysis Complete.
* 4 total analysis engine exceptions.
Writing report to G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.
ITLC.Web\fxcop-report.xml...
Done:00:00:01.4219205
If I execute the same call without the /aspnet parameter, FxCopCmd runs fine:
C:\Program Files\Microsoft Fxcop 10.0>FxCopCmd.exe /file:G:\sbs1\workspace\Projeto2\DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ruleset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /forceoutput /searchgac
Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86
Copyright (C) Microsoft Corporation, All Rights Reserved.
Loaded designrules.dll...
Loaded globalizationrules.dll...
Loaded interoperabilityrules.dll...
Loaded mobilityrules.dll...
Loaded namingrules.dll...
Loaded performancerules.dll...
Loaded portabilityrules.dll...
Loaded securityrules.dll...
Loaded securitytransparencyrules.dll...
Loaded usagerules.dll...
Loaded DCX.ITLC.Web.dll...
Initializing Introspection engine...
Analyzing...
Analysis Complete.
Writing report to G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml...
Done:00:00:02.2656975
The components that I'm using are:
- SonarQube 4.5.1
- Analysis Bootstrapper for Visual Studio Projects 1.2
- C# 3.3
I'd love to find a way to disable the use of the /aspnet parameter on SonarQube. Any help will be greatly appreciated.
Indeed FxCop 10 has some troubles with the /aspnet switch. FxCop version 12 (which is bundled with Visual Studio 2013) properly handles that switch.
The issue you are describing is a known issue, which has not yet been fixed as of today, but for which there is a ticket: http://jira.codehaus.org/browse/SONARVS-62
In the very short term, you could create a wrapper around FxCopCmd.exe to strip the flag.

Cannot Import Asmx web service reference in vs 2010

I have web site built in visual studio 2008 using .net framework 3.5.Now i want to migrate the web site code to visual studio 2010 but want to keep the target framework to same i.e 3.5. The web site is built using vb.Net.MY problem is when i am importing the reference of web service in visual studio 2010 it show error as "NameSpace or type specified in imports 'WebReference' does not contain any public methods".My service name is "WebReference" . I thought may be .net has built in System.web.services.Description.Webreference ,may be it shows conflict ,so i tried to rename it to "WebReference1" or some other name but it does not have any effect,yhe error is still there.What am i missing?
probably it is because you cannot use importer :
ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
in vs 2010....you need vs 2012 because that only has support for .net framework 4.5 which in turn has assembly references to ServiceDescriptionImporter .

visual studio 2010 using SQLCe 3.5 but project has 4.4 sdf file

I have added sql compack edition v4.0 file on my windows phone 7 project in visual studio 2010. I copied the data base from application folder to isolated storage, now while querying it gives this thing
countyList.Count()
A first chance exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in Microsoft.Phone.Data.Internal.dll
'countyList.Count()' threw an exception of type 'System.Data.SqlServerCe.SqlCeException'
base {System.Data.Common.DbException}: {"Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 4000000,Requested version = 3505053,File name = AMEDatabase.sdf ]"}
_customMessage: "Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 4000000,Requested version = 3505053,File name = AMEDatabase.sdf ]"
_errors: {System.Data.SqlServerCe.SqlCeErrorCollection}
Errors: {System.Data.SqlServerCe.SqlCeErrorCollection}
HResult: -2147467259
Message: "Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 4000000,Requested version = 3505053,File name = AMEDatabase.sdf ]"
NativeError: 28609
Source: "SQL Server Compact ADO.NET Data Provider"
when i added this file from my visual studio how this thing can use 3.5 version??
what to do? could it be coz the System.Data.Linq file?(my project has v 2.0 of this dll)
You can only use SQL Servver Compact verision 3.5 databases with Windows Phone
We need some settings to use sql ce v4.0 in VS 2010, hit googles for more info.

ATL development with VC++ 2008 Express

I have recently installed Windows Server 2003 R2 for gaining access to ATL header and library files. I have set the include and library paths in the Visual C++ 2008 Express to compile the ATL code with cl.exe. When I compile the solution in the VC++ 2008 Express. The following error message comes out.
d:\programs\psdk windows sever 2003\include\atl\atlbase.h(513) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
d:\programs\microsoft visual studio 9.0\vc\include\stdio.h(358) : see declaration of '_vsnprintf'
d:\programs\psdk windows sever 2003\include\atl\atlbase.h(537) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
d:\programs\microsoft visual studio 9.0\vc\include\stdio.h(358) : see declaration of '_vsnprintf'
d:\programs\psdk windows sever 2003\include\atl\atlbase.h(561) : warning C4996: '_vsnwprintf': This function or variable may be unsafe. Consider using _vsnwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
d:\programs\microsoft visual studio 9.0\vc\include\wchar.h(719) : see declaration of '_vsnwprintf'
d:\programs\psdk windows sever 2003\include\atl\atlbase.h(584) : warning C4996: '_vsnwprintf': This function or variable may be unsafe. Consider using _vsnwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
d:\programs\microsoft visual studio 9.0\vc\include\wchar.h(719) : see declaration of '_vsnwprintf'
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
LINK : fatal error LNK1104: cannot open file 'atlthunk.lib'
Any help would be worth...
1.find 'atlthunk.lib' whole project,
if find '#pragma comment(lib, "atlthunk.lib")',and delete it.
2.project setting link -> input->add-on dependency, remove 'atlthunk.lib'.

Resources