VS2017 C# default assembliesSystem.Core.dll in 4.0 added by default?using semaphore in c#How do I calculate someone's age in C#?What is the difference between String and string in C#?Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?What are the correct version numbers for C#?Why is Dictionary preferred over Hashtable in C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Could not find a part of the path … binroslyncsc.exe
Combinations of multiple lists
Can I use a neutral wire from another outlet to repair a broken neutral?
Why is Collection not simply treated as Collection<?>
If a Gelatinous Cube takes up the entire space of a Pit Trap, what happens when a creature falls into the trap but succeeds on the saving throw?
Took a trip to a parallel universe, need help deciphering
UK: Is there precedent for the governments e-petition site changing the direction of a government decision?
Is delete *p an alternative to delete [] p?
What reasons are there for a Capitalist to oppose a 100% inheritance tax?
Why can't we play rap on piano?
Can a virus destroy the BIOS of a modern computer?
What does it mean to describe someone as a butt steak?
Can a rocket refuel on Mars from water?
Blender 2.8 I can't see vertices, edges or faces in edit mode
Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?
90's TV series where a boy goes to another dimension through portal near power lines
Infinite Abelian subgroup of infinite non Abelian group example
I would say: "You are another teacher", but she is a woman and I am a man
Do I have a twin with permutated remainders?
SSH "lag" in LAN on some machines, mixed distros
Twin primes whose sum is a cube
What is the word for reserving something for yourself before others do?
How to take photos in burst mode, without vibration?
I'm flying to France today and my passport expires in less than 2 months
1960's book about a plague that kills all white people
VS2017 C# default assemblies
System.Core.dll in 4.0 added by default?using semaphore in c#How do I calculate someone's age in C#?What is the difference between String and string in C#?Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?What are the correct version numbers for C#?Why is Dictionary preferred over Hashtable in C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Could not find a part of the path … binroslyncsc.exe
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
For testing Semaphore Class was created sample:
using System;
using System.Threading;
class MyThread
{
public Thread Thrd;
static Semaphore sem = new Semaphore(2, 2);
....
But I am not able to compile Its giving me this error (CS0246)
The type or namespace name 'Semaphore' could not be found
(are you missing a using directive or an assembly reference?)
I found solution ("added reference 'System' again") to decide this problem from other issue, but the Question was born - which default assemblies in the C# standard project VS2017 include without additional references in project?
Because by .Net documentation Semaphore Class
Definition Namespace: System.Threading
Assemblies: System.Threading.dll, System.dll, netstandard.dll
But without ("added reference 'System' again") the Thread Class and SemaphoreSlim Class worked normally (without compiler error CS0246), by .Net documentation for these classes:
Assemblies: System.Threading.dll, mscorlib.dll, netstandard.dll
Difference is System.dll vs mscorlib.dll only (It's expected), but when i try, at command prompt, again compile program by csc.exe and msbuild.
The msbuild given the same result as VS IDE (It's expected) - compile error CS0246, but
csc.exe sem.cs -out:sem.exe
are compiling without error and after that program is runned & normally worked.
If I right understood (.Net docs) by default "csc.exe" must include only mscorlib.dll, all other assemblies must be include explicitly by options "-lib" or/and "-reference"?
Why program normally was compiled without explicit reference to "System.Threading.dll, System.dll, netstandard.dll"?
c# .net msbuild csc
add a comment |
For testing Semaphore Class was created sample:
using System;
using System.Threading;
class MyThread
{
public Thread Thrd;
static Semaphore sem = new Semaphore(2, 2);
....
But I am not able to compile Its giving me this error (CS0246)
The type or namespace name 'Semaphore' could not be found
(are you missing a using directive or an assembly reference?)
I found solution ("added reference 'System' again") to decide this problem from other issue, but the Question was born - which default assemblies in the C# standard project VS2017 include without additional references in project?
Because by .Net documentation Semaphore Class
Definition Namespace: System.Threading
Assemblies: System.Threading.dll, System.dll, netstandard.dll
But without ("added reference 'System' again") the Thread Class and SemaphoreSlim Class worked normally (without compiler error CS0246), by .Net documentation for these classes:
Assemblies: System.Threading.dll, mscorlib.dll, netstandard.dll
Difference is System.dll vs mscorlib.dll only (It's expected), but when i try, at command prompt, again compile program by csc.exe and msbuild.
The msbuild given the same result as VS IDE (It's expected) - compile error CS0246, but
csc.exe sem.cs -out:sem.exe
are compiling without error and after that program is runned & normally worked.
If I right understood (.Net docs) by default "csc.exe" must include only mscorlib.dll, all other assemblies must be include explicitly by options "-lib" or/and "-reference"?
Why program normally was compiled without explicit reference to "System.Threading.dll, System.dll, netstandard.dll"?
c# .net msbuild csc
Do you use-noconfig?
– PetSerAl
Mar 8 at 23:37
@PetSerAl You are Damn good :) You was right with -noconfig option (without csc.rsp file) it works (csc.exe) the same as msbuild
– Denis Sivtsov
Mar 8 at 23:53
But what with regarding other assemblies "System.Threading.dll, netstandard.dll", which was stated for "Semaphore Class, Thread Class and SemaphoreSlim Class"? These Dlls absent in csc.rsp file ?
– Denis Sivtsov
Mar 9 at 0:04
The assembly depend on your target framework. It isSystem.Threading.dllfor .NET Core,System.dllfor .NET Framework andnetstandard.dllfor .NET Standard. You need only one not all three of them.
– PetSerAl
Mar 9 at 8:09
add a comment |
For testing Semaphore Class was created sample:
using System;
using System.Threading;
class MyThread
{
public Thread Thrd;
static Semaphore sem = new Semaphore(2, 2);
....
But I am not able to compile Its giving me this error (CS0246)
The type or namespace name 'Semaphore' could not be found
(are you missing a using directive or an assembly reference?)
I found solution ("added reference 'System' again") to decide this problem from other issue, but the Question was born - which default assemblies in the C# standard project VS2017 include without additional references in project?
Because by .Net documentation Semaphore Class
Definition Namespace: System.Threading
Assemblies: System.Threading.dll, System.dll, netstandard.dll
But without ("added reference 'System' again") the Thread Class and SemaphoreSlim Class worked normally (without compiler error CS0246), by .Net documentation for these classes:
Assemblies: System.Threading.dll, mscorlib.dll, netstandard.dll
Difference is System.dll vs mscorlib.dll only (It's expected), but when i try, at command prompt, again compile program by csc.exe and msbuild.
The msbuild given the same result as VS IDE (It's expected) - compile error CS0246, but
csc.exe sem.cs -out:sem.exe
are compiling without error and after that program is runned & normally worked.
If I right understood (.Net docs) by default "csc.exe" must include only mscorlib.dll, all other assemblies must be include explicitly by options "-lib" or/and "-reference"?
Why program normally was compiled without explicit reference to "System.Threading.dll, System.dll, netstandard.dll"?
c# .net msbuild csc
For testing Semaphore Class was created sample:
using System;
using System.Threading;
class MyThread
{
public Thread Thrd;
static Semaphore sem = new Semaphore(2, 2);
....
But I am not able to compile Its giving me this error (CS0246)
The type or namespace name 'Semaphore' could not be found
(are you missing a using directive or an assembly reference?)
I found solution ("added reference 'System' again") to decide this problem from other issue, but the Question was born - which default assemblies in the C# standard project VS2017 include without additional references in project?
Because by .Net documentation Semaphore Class
Definition Namespace: System.Threading
Assemblies: System.Threading.dll, System.dll, netstandard.dll
But without ("added reference 'System' again") the Thread Class and SemaphoreSlim Class worked normally (without compiler error CS0246), by .Net documentation for these classes:
Assemblies: System.Threading.dll, mscorlib.dll, netstandard.dll
Difference is System.dll vs mscorlib.dll only (It's expected), but when i try, at command prompt, again compile program by csc.exe and msbuild.
The msbuild given the same result as VS IDE (It's expected) - compile error CS0246, but
csc.exe sem.cs -out:sem.exe
are compiling without error and after that program is runned & normally worked.
If I right understood (.Net docs) by default "csc.exe" must include only mscorlib.dll, all other assemblies must be include explicitly by options "-lib" or/and "-reference"?
Why program normally was compiled without explicit reference to "System.Threading.dll, System.dll, netstandard.dll"?
c# .net msbuild csc
c# .net msbuild csc
edited Mar 9 at 11:32
Denis Sivtsov
asked Mar 8 at 23:32
Denis SivtsovDenis Sivtsov
63
63
Do you use-noconfig?
– PetSerAl
Mar 8 at 23:37
@PetSerAl You are Damn good :) You was right with -noconfig option (without csc.rsp file) it works (csc.exe) the same as msbuild
– Denis Sivtsov
Mar 8 at 23:53
But what with regarding other assemblies "System.Threading.dll, netstandard.dll", which was stated for "Semaphore Class, Thread Class and SemaphoreSlim Class"? These Dlls absent in csc.rsp file ?
– Denis Sivtsov
Mar 9 at 0:04
The assembly depend on your target framework. It isSystem.Threading.dllfor .NET Core,System.dllfor .NET Framework andnetstandard.dllfor .NET Standard. You need only one not all three of them.
– PetSerAl
Mar 9 at 8:09
add a comment |
Do you use-noconfig?
– PetSerAl
Mar 8 at 23:37
@PetSerAl You are Damn good :) You was right with -noconfig option (without csc.rsp file) it works (csc.exe) the same as msbuild
– Denis Sivtsov
Mar 8 at 23:53
But what with regarding other assemblies "System.Threading.dll, netstandard.dll", which was stated for "Semaphore Class, Thread Class and SemaphoreSlim Class"? These Dlls absent in csc.rsp file ?
– Denis Sivtsov
Mar 9 at 0:04
The assembly depend on your target framework. It isSystem.Threading.dllfor .NET Core,System.dllfor .NET Framework andnetstandard.dllfor .NET Standard. You need only one not all three of them.
– PetSerAl
Mar 9 at 8:09
Do you use
-noconfig?– PetSerAl
Mar 8 at 23:37
Do you use
-noconfig?– PetSerAl
Mar 8 at 23:37
@PetSerAl You are Damn good :) You was right with -noconfig option (without csc.rsp file) it works (csc.exe) the same as msbuild
– Denis Sivtsov
Mar 8 at 23:53
@PetSerAl You are Damn good :) You was right with -noconfig option (without csc.rsp file) it works (csc.exe) the same as msbuild
– Denis Sivtsov
Mar 8 at 23:53
But what with regarding other assemblies "System.Threading.dll, netstandard.dll", which was stated for "Semaphore Class, Thread Class and SemaphoreSlim Class"? These Dlls absent in csc.rsp file ?
– Denis Sivtsov
Mar 9 at 0:04
But what with regarding other assemblies "System.Threading.dll, netstandard.dll", which was stated for "Semaphore Class, Thread Class and SemaphoreSlim Class"? These Dlls absent in csc.rsp file ?
– Denis Sivtsov
Mar 9 at 0:04
The assembly depend on your target framework. It is
System.Threading.dll for .NET Core, System.dll for .NET Framework and netstandard.dll for .NET Standard. You need only one not all three of them.– PetSerAl
Mar 9 at 8:09
The assembly depend on your target framework. It is
System.Threading.dll for .NET Core, System.dll for .NET Framework and netstandard.dll for .NET Standard. You need only one not all three of them.– PetSerAl
Mar 9 at 8:09
add a comment |
1 Answer
1
active
oldest
votes
By help from PetSerAl, I could find answers on my questions:
- If you compile C# program by csc.exe, the default assemblies (without any explicitly specified by option "-reference" & "-lib") will be included:
- mscorlib.dll (can be suppressed by option "-nostdlib")
- *.dll from csc.rsp file (can be suppressed by option "-noconfig")
If you want compire without any implicit assemblies, usecsc.exe <namefile>.cs -nostdlib -noconfig
If you compile C# program by VS IDE or msbuild (VS IDE using "implicitly" msbuild), the default assemblies (without any explicitly specified by "Add reference" in IDE or by editing the corresponding ".csproj" file) will be include (in case using template VS2017 "Empty Project (.Net Framework)):
- mscorlib.dll
- System.Core.dll
You can check it by use "View/Object Browser" in VS IDE or by run msbuild with show build data
msbuild <NameProject>.proj -v:diag
where you can find information regarding assemblies, which was included in compilation process.
You can't simply suppress including of these assemblies in compilation process, It's demanding changing configuration files of msbuild, that must be doing very gently. Additional information you can find in other issue
If you will decide to examine configuration files of msbuild and how it work, very helpful will be receive working environment of msbuild (value of main variables). I can recommend simple project (you can write by notepad),
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props')" />
<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
<Target Name="ShowVar">
<Message Text="Configuration is $(Configuration)" />
<Message Text="MSBuildToolsPath is $(MSBuildToolsPath)" />
<Message Text="MSBuildExtensionsPath is $(MSBuildExtensionsPath)" />
<Message Text="MSBuildToolsVersion is $(MSBuildToolsVersion)" />
<Message Text="FrameworkPathOverride is $(FrameworkPathOverride)" />
<Message Text="MSBuildUserExtensionsPath is $(MSBuildUserExtensionsPath)" />
<Message Text="AdditionalExplicitAssemblyReferences is $(AdditionalExplicitAssemblyReferences)" />
</Target>
</Project>
if you run build it at command prompt msbuild test.csproj -t:ShowVar
you can see value of main variables, which using msbuild (or you can run msbuild with show build data, as it write foregoing).
P.S>
And as you understood the Semaphore Class (System.dll) by default doesn't include, but namespaces System and System.Threading, and the most commonly using Classes are included.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072426%2fvs2017-c-sharp-default-assemblies%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
By help from PetSerAl, I could find answers on my questions:
- If you compile C# program by csc.exe, the default assemblies (without any explicitly specified by option "-reference" & "-lib") will be included:
- mscorlib.dll (can be suppressed by option "-nostdlib")
- *.dll from csc.rsp file (can be suppressed by option "-noconfig")
If you want compire without any implicit assemblies, usecsc.exe <namefile>.cs -nostdlib -noconfig
If you compile C# program by VS IDE or msbuild (VS IDE using "implicitly" msbuild), the default assemblies (without any explicitly specified by "Add reference" in IDE or by editing the corresponding ".csproj" file) will be include (in case using template VS2017 "Empty Project (.Net Framework)):
- mscorlib.dll
- System.Core.dll
You can check it by use "View/Object Browser" in VS IDE or by run msbuild with show build data
msbuild <NameProject>.proj -v:diag
where you can find information regarding assemblies, which was included in compilation process.
You can't simply suppress including of these assemblies in compilation process, It's demanding changing configuration files of msbuild, that must be doing very gently. Additional information you can find in other issue
If you will decide to examine configuration files of msbuild and how it work, very helpful will be receive working environment of msbuild (value of main variables). I can recommend simple project (you can write by notepad),
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props')" />
<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
<Target Name="ShowVar">
<Message Text="Configuration is $(Configuration)" />
<Message Text="MSBuildToolsPath is $(MSBuildToolsPath)" />
<Message Text="MSBuildExtensionsPath is $(MSBuildExtensionsPath)" />
<Message Text="MSBuildToolsVersion is $(MSBuildToolsVersion)" />
<Message Text="FrameworkPathOverride is $(FrameworkPathOverride)" />
<Message Text="MSBuildUserExtensionsPath is $(MSBuildUserExtensionsPath)" />
<Message Text="AdditionalExplicitAssemblyReferences is $(AdditionalExplicitAssemblyReferences)" />
</Target>
</Project>
if you run build it at command prompt msbuild test.csproj -t:ShowVar
you can see value of main variables, which using msbuild (or you can run msbuild with show build data, as it write foregoing).
P.S>
And as you understood the Semaphore Class (System.dll) by default doesn't include, but namespaces System and System.Threading, and the most commonly using Classes are included.
add a comment |
By help from PetSerAl, I could find answers on my questions:
- If you compile C# program by csc.exe, the default assemblies (without any explicitly specified by option "-reference" & "-lib") will be included:
- mscorlib.dll (can be suppressed by option "-nostdlib")
- *.dll from csc.rsp file (can be suppressed by option "-noconfig")
If you want compire without any implicit assemblies, usecsc.exe <namefile>.cs -nostdlib -noconfig
If you compile C# program by VS IDE or msbuild (VS IDE using "implicitly" msbuild), the default assemblies (without any explicitly specified by "Add reference" in IDE or by editing the corresponding ".csproj" file) will be include (in case using template VS2017 "Empty Project (.Net Framework)):
- mscorlib.dll
- System.Core.dll
You can check it by use "View/Object Browser" in VS IDE or by run msbuild with show build data
msbuild <NameProject>.proj -v:diag
where you can find information regarding assemblies, which was included in compilation process.
You can't simply suppress including of these assemblies in compilation process, It's demanding changing configuration files of msbuild, that must be doing very gently. Additional information you can find in other issue
If you will decide to examine configuration files of msbuild and how it work, very helpful will be receive working environment of msbuild (value of main variables). I can recommend simple project (you can write by notepad),
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props')" />
<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
<Target Name="ShowVar">
<Message Text="Configuration is $(Configuration)" />
<Message Text="MSBuildToolsPath is $(MSBuildToolsPath)" />
<Message Text="MSBuildExtensionsPath is $(MSBuildExtensionsPath)" />
<Message Text="MSBuildToolsVersion is $(MSBuildToolsVersion)" />
<Message Text="FrameworkPathOverride is $(FrameworkPathOverride)" />
<Message Text="MSBuildUserExtensionsPath is $(MSBuildUserExtensionsPath)" />
<Message Text="AdditionalExplicitAssemblyReferences is $(AdditionalExplicitAssemblyReferences)" />
</Target>
</Project>
if you run build it at command prompt msbuild test.csproj -t:ShowVar
you can see value of main variables, which using msbuild (or you can run msbuild with show build data, as it write foregoing).
P.S>
And as you understood the Semaphore Class (System.dll) by default doesn't include, but namespaces System and System.Threading, and the most commonly using Classes are included.
add a comment |
By help from PetSerAl, I could find answers on my questions:
- If you compile C# program by csc.exe, the default assemblies (without any explicitly specified by option "-reference" & "-lib") will be included:
- mscorlib.dll (can be suppressed by option "-nostdlib")
- *.dll from csc.rsp file (can be suppressed by option "-noconfig")
If you want compire without any implicit assemblies, usecsc.exe <namefile>.cs -nostdlib -noconfig
If you compile C# program by VS IDE or msbuild (VS IDE using "implicitly" msbuild), the default assemblies (without any explicitly specified by "Add reference" in IDE or by editing the corresponding ".csproj" file) will be include (in case using template VS2017 "Empty Project (.Net Framework)):
- mscorlib.dll
- System.Core.dll
You can check it by use "View/Object Browser" in VS IDE or by run msbuild with show build data
msbuild <NameProject>.proj -v:diag
where you can find information regarding assemblies, which was included in compilation process.
You can't simply suppress including of these assemblies in compilation process, It's demanding changing configuration files of msbuild, that must be doing very gently. Additional information you can find in other issue
If you will decide to examine configuration files of msbuild and how it work, very helpful will be receive working environment of msbuild (value of main variables). I can recommend simple project (you can write by notepad),
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props')" />
<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
<Target Name="ShowVar">
<Message Text="Configuration is $(Configuration)" />
<Message Text="MSBuildToolsPath is $(MSBuildToolsPath)" />
<Message Text="MSBuildExtensionsPath is $(MSBuildExtensionsPath)" />
<Message Text="MSBuildToolsVersion is $(MSBuildToolsVersion)" />
<Message Text="FrameworkPathOverride is $(FrameworkPathOverride)" />
<Message Text="MSBuildUserExtensionsPath is $(MSBuildUserExtensionsPath)" />
<Message Text="AdditionalExplicitAssemblyReferences is $(AdditionalExplicitAssemblyReferences)" />
</Target>
</Project>
if you run build it at command prompt msbuild test.csproj -t:ShowVar
you can see value of main variables, which using msbuild (or you can run msbuild with show build data, as it write foregoing).
P.S>
And as you understood the Semaphore Class (System.dll) by default doesn't include, but namespaces System and System.Threading, and the most commonly using Classes are included.
By help from PetSerAl, I could find answers on my questions:
- If you compile C# program by csc.exe, the default assemblies (without any explicitly specified by option "-reference" & "-lib") will be included:
- mscorlib.dll (can be suppressed by option "-nostdlib")
- *.dll from csc.rsp file (can be suppressed by option "-noconfig")
If you want compire without any implicit assemblies, usecsc.exe <namefile>.cs -nostdlib -noconfig
If you compile C# program by VS IDE or msbuild (VS IDE using "implicitly" msbuild), the default assemblies (without any explicitly specified by "Add reference" in IDE or by editing the corresponding ".csproj" file) will be include (in case using template VS2017 "Empty Project (.Net Framework)):
- mscorlib.dll
- System.Core.dll
You can check it by use "View/Object Browser" in VS IDE or by run msbuild with show build data
msbuild <NameProject>.proj -v:diag
where you can find information regarding assemblies, which was included in compilation process.
You can't simply suppress including of these assemblies in compilation process, It's demanding changing configuration files of msbuild, that must be doing very gently. Additional information you can find in other issue
If you will decide to examine configuration files of msbuild and how it work, very helpful will be receive working environment of msbuild (value of main variables). I can recommend simple project (you can write by notepad),
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props')" />
<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
<Target Name="ShowVar">
<Message Text="Configuration is $(Configuration)" />
<Message Text="MSBuildToolsPath is $(MSBuildToolsPath)" />
<Message Text="MSBuildExtensionsPath is $(MSBuildExtensionsPath)" />
<Message Text="MSBuildToolsVersion is $(MSBuildToolsVersion)" />
<Message Text="FrameworkPathOverride is $(FrameworkPathOverride)" />
<Message Text="MSBuildUserExtensionsPath is $(MSBuildUserExtensionsPath)" />
<Message Text="AdditionalExplicitAssemblyReferences is $(AdditionalExplicitAssemblyReferences)" />
</Target>
</Project>
if you run build it at command prompt msbuild test.csproj -t:ShowVar
you can see value of main variables, which using msbuild (or you can run msbuild with show build data, as it write foregoing).
P.S>
And as you understood the Semaphore Class (System.dll) by default doesn't include, but namespaces System and System.Threading, and the most commonly using Classes are included.
edited Mar 9 at 23:22
answered Mar 9 at 22:35
Denis SivtsovDenis Sivtsov
63
63
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072426%2fvs2017-c-sharp-default-assemblies%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you use
-noconfig?– PetSerAl
Mar 8 at 23:37
@PetSerAl You are Damn good :) You was right with -noconfig option (without csc.rsp file) it works (csc.exe) the same as msbuild
– Denis Sivtsov
Mar 8 at 23:53
But what with regarding other assemblies "System.Threading.dll, netstandard.dll", which was stated for "Semaphore Class, Thread Class and SemaphoreSlim Class"? These Dlls absent in csc.rsp file ?
– Denis Sivtsov
Mar 9 at 0:04
The assembly depend on your target framework. It is
System.Threading.dllfor .NET Core,System.dllfor .NET Framework andnetstandard.dllfor .NET Standard. You need only one not all three of them.– PetSerAl
Mar 9 at 8:09